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.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py
index 3e89273a0..05eef2c96 100644
--- a/archaeological_finds/tests.py
+++ b/archaeological_finds/tests.py
@@ -29,7 +29,7 @@ from ishtar_common.models import ImporterType, IshtarUser, ImporterColumn,\
FormaterType, ImportTarget, IshtarSiteProfile
from ishtar_common.models import Person, get_current_profile
-from archaeological_context_records.models import Period, Dating
+from archaeological_context_records.models import Period, Dating, ContextRecord
from archaeological_finds import models, views
from archaeological_warehouse.models import Warehouse, WarehouseType
@@ -356,6 +356,30 @@ class FindTest(FindInit, TestCase):
u"{}-{}".format(
base_find.context_record.external_id,
base_find.label))
+ base_find.label = "New label"
+ base_find.save()
+ base_find = models.BaseFind.objects.get(pk=base_find.pk)
+ self.assertEqual(
+ base_find.external_id,
+ u"{}-{}".format(
+ base_find.context_record.external_id,
+ "New label"))
+ cr = ContextRecord.objects.get(pk=base_find.context_record.pk)
+ cr.label = "new-label-too"
+ cr.save()
+ base_find = models.BaseFind.objects.get(pk=base_find.pk)
+ find = models.Find.objects.get(pk=find.pk)
+ cr = ContextRecord.objects.get(pk=cr.pk)
+ self.assertIn("new-label-too", find.external_id)
+ self.assertIn("new-label-too", base_find.external_id)
+
+ cr.operation.code_patriarche = "PAT"
+ cr.operation.save()
+ base_find = models.BaseFind.objects.get(pk=base_find.pk)
+ find = models.Find.objects.get(pk=find.pk)
+ cr = ContextRecord.objects.get(pk=cr.pk)
+ self.assertIn("PAT", find.external_id)
+ self.assertIn("PAT", base_find.external_id)
def testIndex(self):
profile = get_current_profile()