diff options
author | Thomas André <thomas.andre@iggdrasil.net> | 2025-04-17 08:58:48 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-07-29 08:49:03 +0200 |
commit | 283c594606b5c69ef2cc750f4eabdafcc904f0b4 (patch) | |
tree | 61091917fbb7b4d1213b4f16ec367b6400fb6588 /archaeological_context_records/tests.py | |
parent | af13ebbe3d2314cef33bd8f9e372f62518db4465 (diff) | |
download | Ishtar-283c594606b5c69ef2cc750f4eabdafcc904f0b4.tar.bz2 Ishtar-283c594606b5c69ef2cc750f4eabdafcc904f0b4.zip |
Tests for the convertion of data from the database to a .gpkg + Modifications to keep specific importers in Ishtar
Diffstat (limited to 'archaeological_context_records/tests.py')
-rw-r--r-- | archaeological_context_records/tests.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py index 1716920e9..4cdf676b6 100644 --- a/archaeological_context_records/tests.py +++ b/archaeological_context_records/tests.py @@ -20,6 +20,7 @@ import csv import json from io import StringIO import locale +import os from django.apps import apps from django.conf import settings @@ -230,12 +231,12 @@ class ImportContextRecordTest(ImportTest, TestCase): """ # Definition of the path to test importer data for GIS data root = settings.LIB_BASE_PATH + "archaeological_context_records/tests/" - filename = root + "qfield-ue-test.zip" + filename = os.path.join(root, "qfield-ue-test.zip") self.restore_serialized(filename) # Uses of a class in ishtar_commons.model_import to retrieve a model via its slug (?) imp_type = ImporterType.objects.get(slug="qfield-ue-test") # Change the name with the slug of the importeur !!! # Opening of the CSV - with open(root + "qfield-importeur-data.csv", "rb") as imp_file : + with open(os.path.join(root, "qfield-importeur-data.csv"), "rb") as imp_file : file_dict = { "imported_file": SimpleUploadedFile(imp_file.name, imp_file.read()) } @@ -252,20 +253,22 @@ class ImportContextRecordTest(ImportTest, TestCase): ) self.assertTrue(form.is_valid()) impt = form.save(self.ishtar_user) - # Initialisation de l'import + # Initialisation of the importation impt.initialize() # Creation of an operation for the importation ope, __ = models.Operation.objects.get_or_create( code_patriarche="OP", operation_type=models_ope.OperationType.objects.all()[0]) - # Getting referential values (nb objects, containers,docs, etc.) nb_cr = models.ContextRecord.objects.count() # Beggining of importation impt.importation() # Getting values after modifications self.assertEqual(models.ContextRecord.objects.count(), nb_cr + 1) - + new = models.ContextRecord.objects.order_by("-pk").all()[:1] + for cr in new: + print(cr.main_geodata) + #self.assertTrue(cr.main_geodata.point_3d) # To modify in future class ContextRecordInit(OperationInitTest): |