From c3b928b50cda4c087699fff50fd6e91dd75d2580 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 24 Jul 2017 19:34:27 +0200 Subject: Datings: post-fix of duplicates associated to the same object (usually on imports) --- archaeological_finds/tests.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'archaeological_finds/tests.py') diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index 41e113245..86c7936ba 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -119,6 +119,11 @@ class FindWizardCreationTest(WizardTest, FindInit, TestCase): 'check_date': '2016-01-01' }, 'dating-find_creation': [ + { + 'period': None, + 'start_date': '0', + 'end_date': '200', + }, { 'period': None, 'start_date': '0', @@ -135,8 +140,11 @@ class FindWizardCreationTest(WizardTest, FindInit, TestCase): self.form_datas[0].form_datas['selecrecord-find_creation']['pk'] = \ cr.pk + period = Period.objects.all()[0].pk self.form_datas[0].form_datas['dating-find_creation'][0]['period'] = \ - Period.objects.all()[0].pk + period + self.form_datas[0].form_datas['dating-find_creation'][1]['period'] = \ + period self.find_number = models.Find.objects.count() self.basefind_number = models.BaseFind.objects.count() super(FindWizardCreationTest, self).pre_wizard() @@ -146,6 +154,9 @@ class FindWizardCreationTest(WizardTest, FindInit, TestCase): self.basefind_number + 1) self.assertEqual(models.Find.objects.count(), self.find_number + 1) + # identical datings, only one should be finaly save + f = models.Find.objects.order_by("-pk").all()[0] + self.assertEqual(f.datings.count(), 1) class FindWizardDeletionWithWarehouseModTest(WizardTest, FindInit, TestCase): -- cgit v1.2.3