diff options
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r-- | archaeological_operations/tests.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 60078b7e2..0d6908374 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -1245,6 +1245,7 @@ class OperationWizardCreationTest(WizardTest, OperationInitTest, TestCase): form_datas={ 'filechoice': {}, 'general': { + 'code_patriarche': 'codeope1', 'operation_type': None, 'year': 2016}, 'townsgeneral': [], @@ -1259,6 +1260,7 @@ class OperationWizardCreationTest(WizardTest, OperationInitTest, TestCase): form_datas={ 'filechoice': {}, 'general': { + 'code_patriarche': 'codeope2', 'operation_type': None, 'year': 2016}, 'townsgeneral': [], @@ -1273,6 +1275,7 @@ class OperationWizardCreationTest(WizardTest, OperationInitTest, TestCase): form_datas={ 'filechoice': {}, 'general': { + 'code_patriarche': 'codeope3', 'operation_type': None, 'year': 2016}, 'towns': [], @@ -1332,8 +1335,17 @@ class OperationWizardCreationTest(WizardTest, OperationInitTest, TestCase): def post_wizard(self): self.assertEqual(models.Operation.objects.count(), self.operation_number + 3) + operations = models.Operation.objects.order_by("-pk").all()[:3] + + parcel_ids = [] + for operation in operations: + for parcel in operation.parcels.all(): + parcel_ids.append(parcel.external_id) + self.assertEqual(list(sorted(parcel_ids)), + ['codeope1-12345-S42', 'codeope2-12345-S42', + 'codeope3-12345-G43']) self.assertEqual(models.Parcel.objects.count(), - self.parcel_number + 2) + self.parcel_number + 3) class OperationWizardModifTest(WizardTest, OperationInitTest, TestCase): @@ -1369,6 +1381,7 @@ class OperationWizardModifTest(WizardTest, OperationInitTest, TestCase): form_datas={ 'selec': {}, 'general': { + 'code_patriarche': "codeope42", 'operation_type': 2, 'year': 2017}, 'townsgeneral': [], @@ -1470,6 +1483,10 @@ class OperationWizardModifTest(WizardTest, OperationInitTest, TestCase): # the init parcel is not detached from the operation test_object.assertEqual(operation.parcels.count(), test_object.parcel_number + 1) + # update teh external id on update + cr = ContextRecord.objects.get(pk=self.cr.pk) + test_object.assertEqual(cr.external_id, + "codeope42-12345-A1-Context record") def pre_third_wizard(test_object): parcel_nb = models.Parcel.objects.count() |