diff options
Diffstat (limited to 'archaeological_operations')
-rw-r--r-- | archaeological_operations/tests.py | 20 | ||||
-rw-r--r-- | archaeological_operations/tests/operations-with-json-fields.csv | 6 |
2 files changed, 22 insertions, 4 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 02635a05c..4edf62e22 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -466,7 +466,7 @@ class ImportOperationTest(ImportTest, TestCase): col_number=11) formater_type = FormaterType.objects.get( formater_type='IntegerFormater') - ImportTarget.objects.create( + it = ImportTarget.objects.create( column=col, target='data__autre_refs__arbitraire', formater_type=formater_type) impt = form.save(self.ishtar_user) @@ -478,6 +478,24 @@ class ImportOperationTest(ImportTest, TestCase): ope2 = models.Operation.objects.get(code_patriarche='4201') self.assertEqual(ope2.data, {u'autre_refs': {u'arbitraire': 456}}) + # #4292: Import of new JSON fields erase all precedent JSON fields + it.delete() + col2 = ImporterColumn.objects.create(importer_type=importer, + col_number=12) + ImportTarget.objects.create( + column=col2, target='data__autre', + formater_type=formater_type) + impt = form.save(self.ishtar_user) + impt.initialize() + self.init_ope_targetkey(imp=impt) + impt.importation() + ope1 = models.Operation.objects.get(code_patriarche='4200') + self.assertEqual(ope1.data, {u'autre_refs': {u'arbitraire': 789}, + u"autre": 666}) + ope2 = models.Operation.objects.get(code_patriarche='4201') + self.assertEqual(ope2.data, {u'autre_refs': {u'arbitraire': 456}, + u"autre": 333}) + class ImportStepByStepTest(ImportTest, TestCase): fixtures = OPERATION_TOWNS_FIXTURES diff --git a/archaeological_operations/tests/operations-with-json-fields.csv b/archaeological_operations/tests/operations-with-json-fields.csv index 015497b4c..128bb00fd 100644 --- a/archaeological_operations/tests/operations-with-json-fields.csv +++ b/archaeological_operations/tests/operations-with-json-fields.csv @@ -1,3 +1,3 @@ -code OA,region,type operation,intitule operation,operateur,responsable operation,date debut terrain,date fin terrain,chronologie generale,identifiant document georeferencement,notice scientifique,numéro arbitraire -4201,Bourgogne,Fouille programmée,Oppìdum de Paris 2,L'opérateur,,2000/01/31,2002/12/31,Age du Fer,,456 -4200,Bourgogne,Fouille programmée,Oppìdum de Paris,L'opérateur,Jean Sui-Resp'on Sablé,2000/01/22,2002/12/31,Age du Fer & Gallo-Romain & Néolithik & Moderne,,789 +code OA,region,type operation,intitule operation,operateur,responsable operation,date debut terrain,date fin terrain,chronologie generale,identifiant document georeferencement,notice scientifique,numéro arbitraire,autre +4201,Bourgogne,Fouille programmée,Oppìdum de Paris 2,L'opérateur,,2000/01/31,2002/12/31,Age du Fer,,456,333 +4200,Bourgogne,Fouille programmée,Oppìdum de Paris,L'opérateur,Jean Sui-Resp'on Sablé,2000/01/22,2002/12/31,Age du Fer & Gallo-Romain & Néolithik & Moderne,,789,666 |