diff --git a/backend/geonature/tests/fixtures.py b/backend/geonature/tests/fixtures.py index dc6a90fed6..368f8a68cd 100644 --- a/backend/geonature/tests/fixtures.py +++ b/backend/geonature/tests/fixtures.py @@ -684,7 +684,7 @@ def synthese_with_protected_status(users, datasets, source): pytest.Fixture fixture with synthese observations """ - synthese_element = {} + synthese_element = [] # Retrieve protected taxon from the bdc_statut_taxons table protected_taxon = db.session.scalars( @@ -711,7 +711,7 @@ def synthese_with_protected_status(users, datasets, source): cor_observers=[users["self_user"]], ) db.session.add(synthese) - synthese_element[taxon.cd_nom] = synthese + synthese_element.append(synthese) return synthese_element diff --git a/backend/geonature/tests/test_synthese.py b/backend/geonature/tests/test_synthese.py index f311a85832..5595d73cb3 100644 --- a/backend/geonature/tests/test_synthese.py +++ b/backend/geonature/tests/test_synthese.py @@ -905,8 +905,11 @@ def assert_export_status_results(user, set_expected_cd_ref): user = users["user"] set_expected_cd_ref = set( - db.session.scalars(select(Taxref.cd_ref).where(Taxref.cd_nom == obs.cd_nom)).one() - for obs in synthese_with_protected_status.values() + db.session.scalars( + select(Taxref.cd_ref).where( + Taxref.cd_nom.in_([el.cd_nom for el in synthese_with_protected_status]) + ) + ).all() ) assert_export_status_results(user, set_expected_cd_ref)