From 141044c1f2ee310770de89fbbbfad1cae4ef857e Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 25 Apr 2022 17:20:43 +0200 Subject: Geodata: test shp import - fix table import --- archaeological_context_records/tests.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'archaeological_context_records/tests.py') diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py index 5b839986e..acebda49b 100644 --- a/archaeological_context_records/tests.py +++ b/archaeological_context_records/tests.py @@ -78,12 +78,18 @@ if settings.SELENIUM_TEST: class ImportContextRecordTest(ImportTest, TestCase): fixtures = CONTEXT_RECORD_TOWNS_FIXTURES - def test_geo_import(self): + def test_geo_import_gpkg(self): + self._test_geo_import("UE-test-gpkg.zip", 9) + + def test_geo_import_shp(self): + self._test_geo_import("UE-test-shp.zip", 12) + + def _test_geo_import(self, data_name, new_nb): root = settings.ROOT_PATH + "../archaeological_context_records/tests/" filename = root + "importer-GIS-UE.zip" self.restore_serialized(filename) imp_type = ImporterType.objects.get(name="GIS - UE") - imp_file = open(root + "UE-test-gpkg.zip", "rb") + imp_file = open(root + data_name, "rb") file_dict = { "imported_file": SimpleUploadedFile(imp_file.name, imp_file.read()) } @@ -102,7 +108,6 @@ class ImportContextRecordTest(ImportTest, TestCase): code_patriarche="184440", operation_type=models_ope.OperationType.objects.all()[0]) impt.importation() - new_nb = 9 self.assertEqual(models.ContextRecord.objects.count() - nb, new_nb) new = models.ContextRecord.objects.order_by("-pk").all()[:new_nb] for cr in new: -- cgit v1.2.3