summaryrefslogtreecommitdiff
path: root/archaeological_finds/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/tests.py')
-rw-r--r--archaeological_finds/tests.py51
1 files changed, 50 insertions, 1 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py
index c17e440b1..8d226e91d 100644
--- a/archaeological_finds/tests.py
+++ b/archaeological_finds/tests.py
@@ -122,8 +122,57 @@ class FindInit(ContextRecordInit):
def get_default_find(self):
return self.create_finds()[0]
+ def tearDown(self):
+ super(FindInit, self).tearDown()
+ if hasattr(self, 'finds'):
+ for f in self.finds:
+ try:
+ f.delete()
+ except:
+ pass
+ self.finds = []
+ if hasattr(self, 'base_finds'):
+ for f in self.base_finds:
+ try:
+ f.delete()
+ except:
+ pass
+ self.base_find = []
+
+
+class FindTest(FindInit, TestCase):
+ fixtures = [settings.ROOT_PATH +
+ '../fixtures/initial_data.json',
+ settings.ROOT_PATH +
+ '../ishtar_common/fixtures/initial_data.json',
+ settings.ROOT_PATH +
+ '../archaeological_files/fixtures/initial_data.json',
+ settings.ROOT_PATH +
+ '../archaeological_operations/fixtures/initial_data-fr.json',
+ settings.ROOT_PATH +
+ '../archaeological_finds/fixtures/initial_data-fr.json',
+ ]
+ model = models.Find
+
+ def setUp(self):
+ self.create_finds()
+
+ def testExternalID(self):
+ find = self.finds[0]
+ base_find = find.base_finds.all()[0]
+ self.assertEqual(
+ find.external_id,
+ u"{}-{}".format(
+ find.get_first_base_find().context_record.external_id,
+ find.label))
+ self.assertEqual(
+ base_find.external_id,
+ u"{}-{}".format(
+ base_find.context_record.external_id,
+ base_find.label))
+
-class PackagingTest(TestCase, FindInit):
+class PackagingTest(FindInit, TestCase):
fixtures = [settings.ROOT_PATH +
'../fixtures/initial_data.json',
settings.ROOT_PATH +