diff options
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r-- | archaeological_operations/tests.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 9111c9ffe..9807e1b87 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -44,7 +44,7 @@ class ImportOperationTest(TestCase): settings.ROOT_PATH + '../ishtar_common/fixtures/initial_data-fr.json', settings.ROOT_PATH + - '../ishtar_common/fixtures/initial_towns-fr.json', + '../ishtar_common/fixtures/test_towns.json', settings.ROOT_PATH + '../ishtar_common/fixtures/initial_importtypes-fr.json', settings.ROOT_PATH + @@ -80,14 +80,25 @@ class ImportOperationTest(TestCase): # operation_type value self.assertTrue(current_ope_nb == first_ope_nb) - # doing manualy the connection assuming that the last 'operation_type' - # target is the one we need + # doing manualy connections tg = TargetKey.objects.filter(target__target='operation_type' ).order_by('-pk').all()[0] tg.value = models.OperationType.objects.get(txt_idx='prog_excavation').pk tg.is_set = True tg.save() + target = TargetKey.objects.get(key='gallo-romain') + gallo = models.Period.objects.get(txt_idx='gallo-roman') + target.value = gallo.pk + target.is_set = True + target.save() + + target = TargetKey.objects.get(key='age-du-fer') + iron = models.Period.objects.get(txt_idx='iron_age') + target.value = iron.pk + target.is_set = True + target.save() + impt.importation() # a new operation has now been imported current_ope_nb = models.Operation.objects.count() @@ -96,6 +107,10 @@ class ImportOperationTest(TestCase): last_ope = models.Operation.objects.order_by('-pk').all()[0] self.assertTrue(last_ope.code_patriarche == 4000) self.assertTrue(last_ope.operation_type.txt_idx == 'prog_excavation') + self.assertEqual(last_ope.periods.count(), 2) + periods = last_ope.periods.all() + self.assertTrue(iron in periods and gallo in periods) + # a second importation will be not possible: no two same patriarche code impt.importation() |