Skip to content

Commit

Permalink
feat(api): add group3_inpn filter to allnamebylist
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Vergez committed Oct 16, 2023
1 parent 5ab3f6e commit ef8170b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apptax/taxonomie/routestaxref.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,10 @@ def get_AllTaxrefNameByListe(code_liste=None):
if group2_inpn:
q = q.filter(VMTaxrefListForautocomplete.group2_inpn == group2_inpn)

group3_inpn = request.args.get("group3_inpn")
if group3_inpn:
q = q.filter(VMTaxrefListForautocomplete.group3_inpn == group3_inpn)

limit = request.args.get("limit", 20, int)
page = request.args.get("page", 1, int)
if "offset" in request.args:
Expand Down
16 changes: 16 additions & 0 deletions apptax/tests/test_taxref.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ def test_get_allnamebyListe_routes_without_list(self):
if data:
assert self.schema_allnamebyListe.is_valid(data)

def test_get_allnamebyListe_routes_without_list_filter_group3(self):
query_string = {
"limit": 10,
"search_name": "poa",
"regne": "Plantae",
"group2_inpn": "Angiospermes",
"group3_inpn": "Autres",
}
response = self.client.get(
url_for("taxref.get_AllTaxrefNameByListe", code_liste=-1), query_string=query_string
)
assert response.status_code == 200
data = response.json
if data:
assert self.schema_allnamebyListe.is_valid(data)

def test_get_distinct_routes(self):
response = self.client.get(url_for("taxref.getDistinctField", field="regne"))
assert response.status_code == 200
Expand Down

0 comments on commit ef8170b

Please sign in to comment.