diff --git a/app/api/justificatifs.py b/app/api/justificatifs.py index 0a5f5350..b3528362 100644 --- a/app/api/justificatifs.py +++ b/app/api/justificatifs.py @@ -689,7 +689,6 @@ def justif_export(justif_id: int | None = None, filename: str | None = None): @as_json @permission_required(Permission.AbsChange) def justif_remove(justif_id: int = None): - # XXX TODO pas de test unitaire """ Supression d'un fichier ou d'une archive { diff --git a/tests/api/test_api_justificatifs.py b/tests/api/test_api_justificatifs.py index 5e73d2c7..5ae86528 100644 --- a/tests/api/test_api_justificatifs.py +++ b/tests/api/test_api_justificatifs.py @@ -38,6 +38,8 @@ JUSTIFICATIFS_FIELDS = { "external_data": dict, } +DEPT_JUSTIFICATIFS_FIELDS = JUSTIFICATIFS_FIELDS | {"formsemestre": dict | None} + CREATE_FIELD = {"justif_id": int, "couverture": list} BATCH_FIELD = {"errors": list, "success": list} @@ -169,6 +171,32 @@ def test_route_justificatifs(api_headers): check_failure_get(f"/justificatifs/{FAUX}/query?", api_headers) +def test_route_justificatifs_formsemestre(api_headers): + """test de la route /justificatifs/formsemestre/""" + # Bon fonctionnement + + data = GET(path="/justificatifs/formsemestre/1", headers=api_headers) + assert isinstance(data, list) + for just in data: + check_fields(just, JUSTIFICATIFS_FIELDS) + + # Mauvais fonctionnement + check_failure_get(path="/justificatifs/formsemestre/42069", headers=api_headers) + + +def test_justificatifs_dept(api_headers): + """test de la route /justificatifs/dept/""" + # Bon fonctionnement + + data = GET(path="/justificatifs/dept/1", headers=api_headers) + assert isinstance(data, list) + for just in data: + check_fields(just, DEPT_JUSTIFICATIFS_FIELDS) + + # Mauvais fonctionnement + check_failure_get(path="/justificatifs/dept/42069", headers=api_headers) + + def test_route_create(api_admin_headers): """test de la route /justificatif//create""" # -== Unique ==-