forked from ScoDoc/ScoDoc
Assiduité : ajout test api manquant closes #689
This commit is contained in:
parent
a79ca4a17d
commit
7eb41fb2eb
@ -689,7 +689,6 @@ def justif_export(justif_id: int | None = None, filename: str | None = None):
|
|||||||
@as_json
|
@as_json
|
||||||
@permission_required(Permission.AbsChange)
|
@permission_required(Permission.AbsChange)
|
||||||
def justif_remove(justif_id: int = None):
|
def justif_remove(justif_id: int = None):
|
||||||
# XXX TODO pas de test unitaire
|
|
||||||
"""
|
"""
|
||||||
Supression d'un fichier ou d'une archive
|
Supression d'un fichier ou d'une archive
|
||||||
{
|
{
|
||||||
|
@ -38,6 +38,8 @@ JUSTIFICATIFS_FIELDS = {
|
|||||||
"external_data": dict,
|
"external_data": dict,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEPT_JUSTIFICATIFS_FIELDS = JUSTIFICATIFS_FIELDS | {"formsemestre": dict | None}
|
||||||
|
|
||||||
CREATE_FIELD = {"justif_id": int, "couverture": list}
|
CREATE_FIELD = {"justif_id": int, "couverture": list}
|
||||||
BATCH_FIELD = {"errors": list, "success": 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)
|
check_failure_get(f"/justificatifs/{FAUX}/query?", api_headers)
|
||||||
|
|
||||||
|
|
||||||
|
def test_route_justificatifs_formsemestre(api_headers):
|
||||||
|
"""test de la route /justificatifs/formsemestre/<int:formsemestre_id>"""
|
||||||
|
# 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/<int:dept_id>"""
|
||||||
|
# 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):
|
def test_route_create(api_admin_headers):
|
||||||
"""test de la route /justificatif/<justif_id:int>/create"""
|
"""test de la route /justificatif/<justif_id:int>/create"""
|
||||||
# -== Unique ==-
|
# -== Unique ==-
|
||||||
|
Loading…
Reference in New Issue
Block a user