diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-05-15 17:58:59 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-05-15 18:00:07 +0200 | 
| commit | cf1b29891bfd9b04db74ce1999530c9326c6cf0e (patch) | |
| tree | 08196ddb09a0260939fd373cbb185d96286b320e /archaeological_operations/tests.py | |
| parent | 049fdf160fbe176c5ea753499b9e7885b3ebf302 (diff) | |
| download | Ishtar-cf1b29891bfd9b04db74ce1999530c9326c6cf0e.tar.bz2 Ishtar-cf1b29891bfd9b04db74ce1999530c9326c6cf0e.zip | |
Data importer: fix bad concat parameter - test manage concat of M2M (many columns)
Diffstat (limited to 'archaeological_operations/tests.py')
| -rw-r--r-- | archaeological_operations/tests.py | 33 | 
1 files changed, 33 insertions, 0 deletions
| diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 957e5d65e..190543e3f 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -334,6 +334,36 @@ class ImportOperationTest(ImportTest, TestCase):          current_ope_nb = models.Operation.objects.count()          self.assertEqual(current_ope_nb, first_ope_nb + 2) +    def test_import_multi_column_concat(self): +        first_ope_nb = models.Operation.objects.count() +        importer, form = self.init_ope_import( +            'MCC-operations-example-multi-col-periods.csv') +        col = ImporterColumn.objects.create(col_number=12, +                                            importer_type_id=importer.pk) +        period_imp = ImporterColumn.objects.get( +            col_number=9, +            importer_type_id=importer.pk) +        period_target = period_imp.targets.all()[0] +        target = ImportTarget.objects.create( +            column=col, target=period_target.target, +            formater_type=period_target.formater_type, concat=True) +        importer, form = self.init_ope_import( +            'MCC-operations-example-multi-col-periods.csv') +        self.assertTrue(form.is_valid()) + +        impt = form.save(self.ishtar_user) +        impt.initialize() +        self.init_ope_targetkey(imp=impt) +        impt.importation() +        current_ope_nb = models.Operation.objects.count() + +        self.assertEqual(current_ope_nb, first_ope_nb + 2) +        modern = models.Period.objects.get(txt_idx='modern') +        for ope in models.Operation.objects.order_by("-pk")[0:2]: +            self.assertIn(modern, list(ope.periods.all())) +        target.delete() +        col.delete() +      def test_import_value_format(self):          importer, form = self.init_ope_import()          column = importer.columns.get(col_number=1) @@ -405,6 +435,9 @@ class ImportOperationTest(ImportTest, TestCase):          impt.importation()          self.assertEqual(len(impt.errors), 2)          self.assertTrue( +            "cody" in impt.errors[0]['error'] +        ) +        self.assertTrue(              "Importer configuration error" in impt.errors[0]['error'] or              "Erreur de configuration de l\'importeur" in              impt.errors[0]['error'] | 
