Skip to content

Commit

Permalink
Test test_get_groupe3_inpn and format of taxrefDetail response
Browse files Browse the repository at this point in the history
  • Loading branch information
amandine-sahl committed Oct 26, 2023
1 parent 6c98cf5 commit 61503b9
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions apptax/tests/test_taxref.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,37 @@ class TestAPITaxref:
]
)

schema_taxref_detail = Schema(
{
"cd_nom": int,
"cd_ref": int,
"cd_sup": int,
"cd_taxsup": int,
"phylum": str,
"regne": str,
Optional("classe"): str,
"ordre": str,
"famille": str,
"group1_inpn": str,
"group2_inpn": str,
"group3_inpn": str,
"id_rang": str,
"nom_complet": str,
"nom_habitat": str,
"nom_rang": str,
"nom_statut": str,
"nom_valide": str,
"nom_vern": str,
"status": dict,
"synonymes": [
{
"cd_nom": int,
"nom_complet": str,
}
],
}
)

def test_get_allnamebyListe_routes(self):
query_string = {"limit": 10}
response = self.client.get(
Expand Down Expand Up @@ -103,6 +134,9 @@ def test_searchfield_routes(self):
def test_taxrefDetail_routes(self):
response = self.client.get(url_for("taxref.getTaxrefDetail", id=29708))
assert response.status_code == 200
data = response.json
if data:
assert self.schema_taxref_detail.is_valid(data)

def test_searchTaxref_routes(self):
query_string = {"ilike-classe": "hex", "page": 1, "limit": 10}
Expand All @@ -125,3 +159,11 @@ def test_taxrefversion_routes(self):
response = self.client.get(url_for("taxref.getTaxrefVersion"))
assert response.status_code == 200
assert json.loads(response.data)["version"] == 16

def test_get_groupe3_inpn(self):
response = self.client.get(url_for("taxref.get_group3_inpn_taxref"))

assert response.status_code == 200
response_json = response.json
assert "Coléoptères" in response_json
assert "Autres" in response_json

0 comments on commit 61503b9

Please sign in to comment.