summaryrefslogtreecommitdiff
path: root/archaeological_context_records/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_context_records/tests.py')
-rw-r--r--archaeological_context_records/tests.py13
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):