diff --git a/backend/gn_module_monitoring/tests/fixtures/site.py b/backend/gn_module_monitoring/tests/fixtures/site.py index 93e695fce..0edadeb05 100644 --- a/backend/gn_module_monitoring/tests/fixtures/site.py +++ b/backend/gn_module_monitoring/tests/fixtures/site.py @@ -1,4 +1,5 @@ import pytest +import json from geoalchemy2.shape import from_shape from geonature.utils.env import db from shapely.geometry import Point @@ -29,9 +30,9 @@ def sites(users, types_site, site_group_with_sites): sites["no-type"] = TMonitoringSites( id_inventor=user.id_role, id_digitiser=user.id_role, - base_site_name=f"no-type", - base_site_description=f"Description-no-type", - base_site_code=f"Code-no-type", + base_site_name="no-type", + base_site_description="Description-no-type", + base_site_code="Code-no-type", geom=geom_4326, # Random id_nomenclature_type_site # FIXME: when id_nomenclature_type_site disapears => remove this line @@ -77,9 +78,15 @@ def site_to_post_with_types(users, types_site, site_group_without_sites): post_data["dataComplement"][type_site_dic["label"]] = copy_dic post_data["dataComplement"]["types_site"] = list_nomenclature_id + post_data["properties"] = MonitoringSitesSchema().dump(site_to_post_with_types) + + post_data["geometry"] = json.loads(post_data["properties"].pop("geometry")) + + post_data["type"] = "Feature" post_data["properties"]["types_site"] = list_nomenclature_id + for type_site in mock_db_type_site: specific_config = type_site["config"]["specific"] for key_specific in specific_config: