summaryrefslogtreecommitdiff
path: root/archaeological_operations/tests.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-02-14 20:47:35 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-02-14 20:47:35 +0100
commitd147e85723e8c9d3466c9b3d56288696b21a6ad8 (patch)
tree6676db2c7e898db0677f0440c5a979616827b8a8 /archaeological_operations/tests.py
parenta372122f76ed2775a858399f790e10807f637d60 (diff)
downloadIshtar-d147e85723e8c9d3466c9b3d56288696b21a6ad8.tar.bz2
Ishtar-d147e85723e8c9d3466c9b3d56288696b21a6ad8.zip
Importer: report bad configuration in a cleaner way
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r--archaeological_operations/tests.py18
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()