diff options
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r-- | archaeological_operations/tests.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 040c7c3d8..7c141af93 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -35,7 +35,8 @@ import models from archaeological_operations import views from ishtar_common.models import OrganizationType, Organization, \ - ImporterType, IshtarUser, TargetKey, ImporterModel, IshtarSiteProfile, Town + ImporterType, IshtarUser, TargetKey, ImporterModel, IshtarSiteProfile, \ + Town, ImporterColumn from archaeological_context_records.models import Unit from ishtar_common import forms_common @@ -203,6 +204,21 @@ class ImportOperationTest(ImportTest, TestCase): self.assertTrue(last_ope == models.Operation.objects.order_by('-pk').all()[0]) + def test_bad_configuration(self): + importer, form = self.init_ope_import() + col = ImporterColumn.objects.get(importer_type=importer, col_number=1) + target = col.targets.all()[0] + target.target = "cody" # random and not appropriate string + target.save() + # self.init_ope() + # importer, form = self.init_ope_import() + impt = form.save(self.ishtar_user) + impt.initialize() + self.init_ope_targetkey(imp=impt) + impt.importation() + self.assertEqual(len(impt.errors), 1) + self.assertIn("Importer configuration error", impt.errors[0]['error']) + def test_model_limitation(self): importer, form = self.init_ope_import() importer.created_models.clear() |