diff options
author | Thomas André <thomas.andre@iggdrasil.net> | 2025-07-01 12:19:45 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-07-29 08:49:03 +0200 |
commit | 0fc1189ccd8f95c6f201e7fbdc86f8345591dc0f (patch) | |
tree | 4fb197424604f89457a9673ce009b71300a5df17 /ishtar_common/tests.py | |
parent | e5de5ee83faf7515c9fba51ea20dd456d5dd07d7 (diff) | |
download | Ishtar-0fc1189ccd8f95c6f201e7fbdc86f8345591dc0f.tar.bz2 Ishtar-0fc1189ccd8f95c6f201e7fbdc86f8345591dc0f.zip |
Export QField Version 3 : Sites and Operations available, corrections of export and automations, optimisations on the values query
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r-- | ishtar_common/tests.py | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 38d7c987d..227008af4 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -96,7 +96,11 @@ from ishtar_common.utils import ( ) from ishtar_common.tasks import launch_export from ishtar_common import utils_secretary -from ishtar_common import views_item + +from .qfield_functions import (gpkg_creation_sites, + gpkg_creation, + modification_style_sites, + modification_style) LIB_BASE_PATH = settings.LIB_BASE_PATH FIXTURE_AUTH_PATH = settings.FIXTURE_AUTH_PATH @@ -2822,11 +2826,11 @@ class BaseImportTest(TestCase): """ # 2) Creation of the .gpkg if str(model._meta) == 'archaeological_operations.archaeologicalsite': - sites, finds, cr, list_ope, list_crea = views_item.gpkg_creation_sites(root, table_cols, col_names, datas) + sites, finds, cr, list_ope, list_crea = gpkg_creation_sites(model, root, table_cols, col_names, datas) # Modification of the source to access the desired project depending on source of the data source = 'specific' else: - finds, cr, list_ope, list_crea = views_item.gpkg_creation(model, root, table_cols, col_names, datas) + finds, cr, list_ope, list_crea = gpkg_creation(model, root, table_cols, col_names, datas) # Modification of the source to access the desired project depending on source of the data source = 'model' # 3) Preparations for the modification of the style in the .qgs file @@ -2835,9 +2839,9 @@ class BaseImportTest(TestCase): if os.path.exists(new_qgs): os.remove(new_qgs) if source == 'specific': - text = views_item.modification_style_sites(qgs_path, table_cols, col_names, list_ope, list_crea) + text = modification_style_sites(qgs_path, table_cols, col_names, list_ope, list_crea) else: - text = views_item.modification_style(qgs_path, table_cols, col_names, list_ope, list_crea) + text = modification_style(qgs_path, table_cols, col_names, list_ope, list_crea) with open(new_qgs, 'w', encoding='utf-8') as file: file.write(text) @@ -2880,26 +2884,27 @@ class BaseImportTest(TestCase): # List of modified and new values to verify the absence/presence depending on the situation if mode == 1: old = ['finds_id', 'finds_cr', 'finds_x', 'finds_y', 'finds_z', 'cr_name', 'cr_operation', 'cr_insee', - 'champ_type', 'cr_occupation', 'cr_description', 'cr_localisation', 'cr_media', 'cr_periode', 'cr_activity'] + 'cr_type', 'cr_occupation', 'cr_description', 'cr_localisation', 'cr_media', 'cr_periode', 'cr_activity'] new = ['Identifiant', 'UE', 'X', 'Y', 'Z', 'Unité_Enregistrement', 'Opération', 'INSEE_Commune', 'Type', 'Interprétation', 'Description', 'Localisation', 'Media', 'Periode', 'Type_Activité'] if mode == 2: old = ['finds_id', 'finds_cr', 'finds_x', 'finds_y', 'finds_z', 'cr_name', 'cr_operation', 'cr_insee', - 'cr_section', 'cr_parcel', 'cr_type', 'cr_occupation', 'cr_description', 'cr_localisation', - 'cr_media', 'cr_periode'] + 'cr_type', 'cr_occupation', 'cr_localisation', 'cr_media', 'cr_periode'] new = ['Identifiant', 'UE', 'X', 'Y', 'Z', 'Unité_Enregistrement', 'Opération', 'INSEE_Commune', - 'Description', 'Localisation', 'Media', 'Periode', 'Type_Activité'] + 'Type', 'Interprétation', 'Localisation', 'Media', 'Periode', 'Type_Activité'] if mode == 3: old = ['cr_name', 'cr_operation', 'cr_wkt', 'finds_id', 'finds_cr', 'finds_date', 'finds_x', 'finds_y', - 'finds_z', 'champ_matériaux', 'cr_description', 'finds_media', 'finds_wkt_modif'] - new = ['Nom', 'Opération', 'WKT_polygon', 'Identifiant', 'UE', 'Date', 'X', 'Y', 'Z', 'Description', + 'finds_z', 'cr_matériaux', 'finds_media', 'finds_wkt_modif'] + new = ['Nom', 'Opération', 'WKT_polygon', 'Identifiant', 'UE', 'Date', 'X', 'Y', 'Z', 'Matériaux', 'Media', 'WKT_point'] with open(new_qgs, 'r', encoding='utf-8') as file: style = file.read() for elem in old: + # print(elem) #debugtest bool = f'name="{elem}"' in style self.assertEqual(bool, False) for elem in new: + # print(elem) #debugtest bool = f'name="{elem}"' in style self.assertEqual(bool, True) for file in dir_list: @@ -2946,6 +2951,7 @@ class BaseImportTest(TestCase): ) for mode in range(1, 4): + # print(mode) #debugtest if mode == 1: table_cols = [['reference'], ['name'], ['operations__code_patriarche'], ['geodata__x'], ['geodata__y'], ['geodata__point_2d']] @@ -2968,7 +2974,6 @@ class BaseImportTest(TestCase): self.export_qfield(mode, model, root, table_cols, col_names, datas) - class ImportTestInterface(BaseImportTest): def setUp(self): |