diff --git a/tests/api/test_api_formsemestre.py b/tests/api/test_api_formsemestre.py index 719dd3a4ae..5853268ea8 100644 --- a/tests/api/test_api_formsemestre.py +++ b/tests/api/test_api_formsemestre.py @@ -144,12 +144,12 @@ def test_formsemestre_apo(api_headers): ### ERROR ### etape_apo_inexistante = "aoefiaozidaoẑidjnoaiznjd" - r = requests.get( + r_error = requests.get( f"{API_URL}/formsemestre/apo/{etape_apo_inexistante}", headers=api_headers, verify=CHECK_CERTIFICATE, ) - assert r.status_code == 404 + assert r_error.status_code == 404 def test_bulletins(api_headers): @@ -180,16 +180,17 @@ def test_formsemestre_etudiants(api_headers): /formsemestre//etudiants/demissionnaires, /formsemestre//etudiants/defaillants """ + formsemestre_id = 1 r = requests.get( - API_URL + "/formsemestre/1/etudiants", + f"{API_URL}/formsemestre/{formsemestre_id}/etudiants", headers=api_headers, verify=CHECK_CERTIFICATE, ) assert r.status_code == 200 formsemestre_etus = r.json() assert isinstance(formsemestre_etus, list) - assert verify_fields(formsemestre_etus, FORMSEMESTRE_ETUS_FIELDS) is True for etu in formsemestre_etus: + assert verify_fields(etu, FORMSEMESTRE_ETUS_FIELDS) is True assert isinstance(etu["id"], int) assert isinstance(etu["nip"], str) assert isinstance(etu["ine"], str) @@ -214,15 +215,16 @@ def test_formsemestre_etudiants(api_headers): ### demissionnaires ### r_demissionnaires = requests.get( - API_URL + "/formsemestre//etudiants/demissionnaires", + f"{API_URL}/formsemestre/{formsemestre_id}/etudiants/demissionnaires", headers=api_headers, verify=CHECK_CERTIFICATE, ) assert r_demissionnaires.status_code == 200 formsemestre_etus = r_demissionnaires.json() assert isinstance(formsemestre_etus, list) - assert verify_fields(formsemestre_etus, FORMSEMESTRE_ETUS_FIELDS) is True + for etu in formsemestre_etus: + assert verify_fields(etu, FORMSEMESTRE_ETUS_FIELDS) is True assert isinstance(etu["id"], int) assert isinstance(etu["nip"], str) assert isinstance(etu["ine"], str) @@ -247,7 +249,7 @@ def test_formsemestre_etudiants(api_headers): ### defaillants ### r_defaillants = requests.get( - API_URL + "/formsemestre//etudiants/defaillants", + f"{API_URL}/formsemestre/{formsemestre_id}/etudiants/defaillants", headers=api_headers, verify=CHECK_CERTIFICATE, ) @@ -255,8 +257,8 @@ def test_formsemestre_etudiants(api_headers): formsemestre_etus = r_defaillants.json() assert isinstance(formsemestre_etus, list) - assert verify_fields(formsemestre_etus, FORMSEMESTRE_ETUS_FIELDS) is True for etu in formsemestre_etus: + assert verify_fields(etu, FORMSEMESTRE_ETUS_FIELDS) is True assert isinstance(etu["id"], int) assert isinstance(etu["nip"], str) assert isinstance(etu["ine"], str) @@ -279,7 +281,9 @@ def test_formsemestre_etudiants(api_headers): assert isinstance(group["group_id"], int) assert group["group_name"] is None or isinstance(group["group_name"], int) - assert r != r_demissionnaires != r_defaillants is True + assert r.json() != r_demissionnaires.json() + assert r.json() != r_defaillants.json() + assert r_demissionnaires.json() != r_defaillants.json() ### ERROR ### id_formsemestre_inexistant = 265165689619851621685 diff --git a/tests/api/tools_test_api.py b/tests/api/tools_test_api.py index f6d9c45385..438c1db591 100644 --- a/tests/api/tools_test_api.py +++ b/tests/api/tools_test_api.py @@ -543,7 +543,7 @@ FORMSEMESTRE_ETUS_FIELDS = { "nom", "nom_usuel", "prenom", - "cvilite", + "civilite", "groups", }