From 5a3ec281438cef4a76b892b2f2f567c72f1e95fd Mon Sep 17 00:00:00 2001 From: TheoLechemia Date: Fri, 8 Mar 2024 16:51:18 +0100 Subject: [PATCH] fix tests --- backend/geonature/tests/test_synthese.py | 31 ++---------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/backend/geonature/tests/test_synthese.py b/backend/geonature/tests/test_synthese.py index 4605dfe391..26030e918f 100644 --- a/backend/geonature/tests/test_synthese.py +++ b/backend/geonature/tests/test_synthese.py @@ -22,6 +22,7 @@ from geonature.utils.config import config from geonature.core.gn_permissions.tools import get_permissions from geonature.core.gn_synthese.utils.blurring import split_blurring_precise_permissions +from geonature.core.gn_synthese.schemas import SyntheseSchema from geonature.core.gn_synthese.utils.query_select_sqla import remove_accents from geonature.core.sensitivity.models import cor_sensitivity_area_type from geonature.core.gn_meta.models import TDatasets @@ -163,6 +164,7 @@ class TestSynthese: def test_required_fields_and_format(self, app, users): # Test required fields base on VSyntheseForWebAppSchema surrounded by a custom converter : CustomRequiredConverter # also test geojson serialization (grouped by geometry and not) + app.config["SYNTHESE"]["LIST_COLUMNS_FRONTEND"] += [{"prop": "altitude_min", "name": "Altitude min"}] url_ungrouped = url_for("gn_synthese.get_observations_for_web") set_logged_user(self.client, users["admin_user"]) resp = self.client.get(url_ungrouped) @@ -490,35 +492,6 @@ def test_filter_cor_observers(self, users, synthese_data): # le requete doit etre OK marlgré la geom NULL assert response.status_code == 200 - @pytest.mark.parametrize( - "additionnal_column", - [("altitude_min"), ("count_min_max"), ("nom_vern_or_lb_nom")], - ) - def test_get_observations_for_web_param_column_frontend( - self, app, users, synthese_data, additionnal_column - ): - """ - Test de renseigner le paramètre LIST_COLUMNS_FRONTEND pour renvoyer uniquement - les colonnes souhaitées - """ - app.config["SYNTHESE"]["LIST_COLUMNS_FRONTEND"] = [ - { - "prop": additionnal_column, - "name": "My label", - } - ] - - set_logged_user(self.client, users["self_user"]) - - response = self.client.get(url_for("gn_synthese.get_observations_for_web")) - data = response.get_json() - - expected_columns = {"id", "url_source", additionnal_column} - - assert all( - set(feature["properties"].keys()) == expected_columns for feature in data["features"] - ) - @pytest.mark.parametrize( "group_inpn", [