summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archaeological_operations/tests.py7
-rw-r--r--archaeological_operations/tests/MCC-operations-example-bad-encoding.csv3
2 files changed, 8 insertions, 2 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py
index 1b64f581d..52a14ce44 100644
--- a/archaeological_operations/tests.py
+++ b/archaeological_operations/tests.py
@@ -57,11 +57,11 @@ class ImportTest(object):
tg.is_set = True
tg.save()
- def init_ope_import(self):
+ def init_ope_import(self, filename='MCC-operations-example.csv'):
mcc_operation = ImporterType.objects.get(name=u"MCC - Opérations")
mcc_operation_file = open(
settings.ROOT_PATH +
- '../archaeological_operations/tests/MCC-operations-example.csv',
+ '../archaeological_operations/tests/' + filename,
'rb')
file_dict = {'imported_file': SimpleUploadedFile(
mcc_operation_file.name, mcc_operation_file.read())}
@@ -209,6 +209,9 @@ class ImportOperationTest(ImportTest, TestCase):
self.assertEqual(last_ope,
models.Operation.objects.order_by('-pk').all()[0])
+ def test_import_bad_encoding(self):
+ self.init_ope_import('MCC-operations-example-bad-encoding.csv')
+
def test_keys_limitation(self):
# each key association is associated to the import
init_ope_number = models.Operation.objects.count()
diff --git a/archaeological_operations/tests/MCC-operations-example-bad-encoding.csv b/archaeological_operations/tests/MCC-operations-example-bad-encoding.csv
new file mode 100644
index 000000000..efd222ee2
--- /dev/null
+++ b/archaeological_operations/tests/MCC-operations-example-bad-encoding.csv
@@ -0,0 +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
+4201,Bourgogne,Fouille programmée,Oppìdum de Paris 2,L'opérateur,,2000/01/31,2002/12/31,Age du Fer,,
+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,,