diff options
Diffstat (limited to 'archaeological_finds/tests.py')
-rw-r--r-- | archaeological_finds/tests.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index c62922499..353ebbdbb 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -349,7 +349,7 @@ class FindTest(FindInit, TestCase): self.client = Client() self.client.login(username=self.username, password=self.password) - def testExternalID(self): + def test_external_id(self): find = self.finds[0] base_find = find.base_finds.all()[0] self.assertEqual( @@ -389,6 +389,29 @@ class FindTest(FindInit, TestCase): self.assertIn("PAT", find.external_id) self.assertIn("PAT", base_find.external_id) + find.label = "hop" + find.save() + find = models.Find.objects.get(pk=find.pk) + # default: {get_first_base_find__context_record__external_id}-{label} + self.assertEqual(find.external_id, u"PAT-12345-A1-new-label-too-hop") + profile = get_current_profile(force=True) + profile.find_external_id = \ + u"{get_first_base_find__context_record__external_id}-{label}-"\ + u"{label}" + profile.save() + find.save() + find = models.Find.objects.get(pk=find.pk) + self.assertEqual(find.external_id, + u"PAT-12345-A1-new-label-too-hop-hop") + profile.find_external_id = \ + u"{get_first_base_find__context_record__external_id}-{label}-" \ + u"{label}||lower||deduplicate" + profile.save() + find.save() + find = models.Find.objects.get(pk=find.pk) + self.assertEqual(find.external_id, + u"pat-12345-a1-new-label-too-hop") + def testIndex(self): profile = get_current_profile() profile.find_index = u"O" |