diff options
Diffstat (limited to 'archaeological_context_records/tests.py')
-rw-r--r-- | archaeological_context_records/tests.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py index 07da79c8a..614156528 100644 --- a/archaeological_context_records/tests.py +++ b/archaeological_context_records/tests.py @@ -26,7 +26,7 @@ from django.core.urlresolvers import reverse from django.test import TestCase from django.test.client import Client -from ishtar_common.models import ImporterType +from ishtar_common.models import ImporterType, IshtarSiteProfile from ishtar_common.tests import create_superuser from archaeological_operations.tests import OperationInitTest, \ ImportOperationTest @@ -109,11 +109,22 @@ class ContextRecordInit(OperationInitTest): def get_default_context_record(self): return self.create_context_record()[0] + def tearDown(self): + if hasattr(self, 'context_records'): + for cr in self.context_records: + try: + cr.delete() + except: + pass + self.context_records = [] + super(ContextRecordInit, self).tearDown() + -class ContextRecordTest(TestCase, ContextRecordInit): +class ContextRecordTest(ContextRecordInit, TestCase): fixtures = ImportContextRecordTest.fixtures def setUp(self): + IshtarSiteProfile.objects.create() self.username, self.password, self.user = create_superuser() self.create_context_record({"label": u"CR 1"}) self.create_context_record({"label": u"CR 2"}) @@ -141,8 +152,14 @@ class ContextRecordTest(TestCase, ContextRecordInit): lines = [line for line in response.content.split('\n') if line] self.assertEqual(len(lines), 3) + def testZExternalID(self): + cr = self.context_records[0] + self.assertEqual( + cr.external_id, + u"{}-{}".format(cr.parcel.external_id, cr.label)) + -class RecordRelationsTest(TestCase, ContextRecordInit): +class RecordRelationsTest(ContextRecordInit, TestCase): fixtures = ImportOperationTest.fixtures model = models.ContextRecord |