Skip to content

Commit

Permalink
ajout et utulisation d'une fixture specifique
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrieuclp committed Jul 30, 2024
1 parent b8e1d8b commit 6cb6f8a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions backend/geonature/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ def synthese_data(app, users, datasets, source, sources_modules):
("p2_af2", 2497, point2, datasets["belong_af_2"], "p2_af2", source),
("p2_af1", 2497, point2, datasets["belong_af_1"], "p2_af1", source),
("p3_af3", 2497, point3, datasets["belong_af_3"], "p3_af3", source),
("tax_search_1", 713776, point1, datasets["own_dataset"], "tax_search_1", sources_modules[0]),
]:
unique_id_sinp = (
"f4428222-d038-40bc-bc5c-6e977bbbc92b" if not data else func.uuid_generate_v4()
Expand Down
6 changes: 3 additions & 3 deletions backend/geonature/tests/test_synthese.py
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,7 @@ def test_observation_count_per_column(self, users, synthese_data):
assert item["count"] >= test_cd_nom["count"]

def test_get_autocomplete_taxons_synthese(self, synthese_data, users):
taxon = db.session.execute(select(Taxref).filter_by(cd_nom=synthese_data["obs1"].cd_nom)).scalar_one()
taxon = db.session.execute(select(Taxref).filter_by(cd_nom=synthese_data["tax_search_1"].cd_nom)).scalar_one()

set_logged_user(self.client, users["self_user"])

Expand All @@ -1384,7 +1384,7 @@ def test_get_autocomplete_taxons_synthese(self, synthese_data, users):
)

assert response.status_code == 200
assert response.json[0]["cd_nom"] == synthese_data["obs1"].cd_nom
assert response.json[0]["cd_nom"] == synthese_data["tax_search_1"].cd_nom

#recherche par le nom valide d'un taxon, alors que seul un synonyme est présent en synthese
response = self.client.get(
Expand All @@ -1393,7 +1393,7 @@ def test_get_autocomplete_taxons_synthese(self, synthese_data, users):
)

assert response.status_code == 200
assert response.json[0]["cd_nom"] == taxon.cd_ref and response.json[0]["cd_nom"] != synthese_data["obs1"].cd_nom
assert response.json[0]["cd_nom"] == taxon.cd_ref and response.json[0]["cd_nom"] != synthese_data["tax_search_1"].cd_nom


@pytest.fixture(scope="class")
Expand Down

0 comments on commit 6cb6f8a

Please sign in to comment.