diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-07-27 11:49:04 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-07-27 11:49:04 +0200 |
commit | 4ad9278e67d8fb024c685df03812c2e1d8313aa1 (patch) | |
tree | dde04c38350d5952174ae29f189c132e56061b3b /archaeological_context_records/tests.py | |
parent | 1b754a300be8844e2e0b45839639cb92002d5d5e (diff) | |
download | Ishtar-4ad9278e67d8fb024c685df03812c2e1d8313aa1.tar.bz2 Ishtar-4ad9278e67d8fb024c685df03812c2e1d8313aa1.zip |
Sync external ID on manual insert (refs #3161)
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 |