summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-03-14 17:49:11 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-03-14 17:49:11 +0100
commit82e5afb0fbc7f2654cdc9e84d9668a38df2a2672 (patch)
treee9ba4737b6cbf07b04b8d1b1e6f938e71f77f4b4
parent97f3da30f9385a952681e315c3561671fcb1d259 (diff)
downloadIshtar-82e5afb0fbc7f2654cdc9e84d9668a38df2a2672.tar.bz2
Ishtar-82e5afb0fbc7f2654cdc9e84d9668a38df2a2672.zip
Test import of files with exotic encoding (refs #3513)
-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,,