correction d'erreurs diverses

This commit is contained in:
leonard_montalbano 2022-06-28 16:03:31 +02:00
parent 3297819892
commit 031dc409be
2 changed files with 14 additions and 10 deletions

View File

@ -144,12 +144,12 @@ def test_formsemestre_apo(api_headers):
### ERROR ### ### ERROR ###
etape_apo_inexistante = "aoefiaozidaoẑidjnoaiznjd" etape_apo_inexistante = "aoefiaozidaoẑidjnoaiznjd"
r = requests.get( r_error = requests.get(
f"{API_URL}/formsemestre/apo/{etape_apo_inexistante}", f"{API_URL}/formsemestre/apo/{etape_apo_inexistante}",
headers=api_headers, headers=api_headers,
verify=CHECK_CERTIFICATE, verify=CHECK_CERTIFICATE,
) )
assert r.status_code == 404 assert r_error.status_code == 404
def test_bulletins(api_headers): def test_bulletins(api_headers):
@ -180,16 +180,17 @@ def test_formsemestre_etudiants(api_headers):
/formsemestre/<int:formsemestre_id>/etudiants/demissionnaires, /formsemestre/<int:formsemestre_id>/etudiants/demissionnaires,
/formsemestre/<int:formsemestre_id>/etudiants/defaillants /formsemestre/<int:formsemestre_id>/etudiants/defaillants
""" """
formsemestre_id = 1
r = requests.get( r = requests.get(
API_URL + "/formsemestre/1/etudiants", f"{API_URL}/formsemestre/{formsemestre_id}/etudiants",
headers=api_headers, headers=api_headers,
verify=CHECK_CERTIFICATE, verify=CHECK_CERTIFICATE,
) )
assert r.status_code == 200 assert r.status_code == 200
formsemestre_etus = r.json() formsemestre_etus = r.json()
assert isinstance(formsemestre_etus, list) assert isinstance(formsemestre_etus, list)
assert verify_fields(formsemestre_etus, FORMSEMESTRE_ETUS_FIELDS) is True
for etu in formsemestre_etus: for etu in formsemestre_etus:
assert verify_fields(etu, FORMSEMESTRE_ETUS_FIELDS) is True
assert isinstance(etu["id"], int) assert isinstance(etu["id"], int)
assert isinstance(etu["nip"], str) assert isinstance(etu["nip"], str)
assert isinstance(etu["ine"], str) assert isinstance(etu["ine"], str)
@ -214,15 +215,16 @@ def test_formsemestre_etudiants(api_headers):
### demissionnaires ### ### demissionnaires ###
r_demissionnaires = requests.get( r_demissionnaires = requests.get(
API_URL + "/formsemestre/<int:formsemestre_id>/etudiants/demissionnaires", f"{API_URL}/formsemestre/{formsemestre_id}/etudiants/demissionnaires",
headers=api_headers, headers=api_headers,
verify=CHECK_CERTIFICATE, verify=CHECK_CERTIFICATE,
) )
assert r_demissionnaires.status_code == 200 assert r_demissionnaires.status_code == 200
formsemestre_etus = r_demissionnaires.json() formsemestre_etus = r_demissionnaires.json()
assert isinstance(formsemestre_etus, list) assert isinstance(formsemestre_etus, list)
assert verify_fields(formsemestre_etus, FORMSEMESTRE_ETUS_FIELDS) is True
for etu in formsemestre_etus: for etu in formsemestre_etus:
assert verify_fields(etu, FORMSEMESTRE_ETUS_FIELDS) is True
assert isinstance(etu["id"], int) assert isinstance(etu["id"], int)
assert isinstance(etu["nip"], str) assert isinstance(etu["nip"], str)
assert isinstance(etu["ine"], str) assert isinstance(etu["ine"], str)
@ -247,7 +249,7 @@ def test_formsemestre_etudiants(api_headers):
### defaillants ### ### defaillants ###
r_defaillants = requests.get( r_defaillants = requests.get(
API_URL + "/formsemestre/<int:formsemestre_id>/etudiants/defaillants", f"{API_URL}/formsemestre/{formsemestre_id}/etudiants/defaillants",
headers=api_headers, headers=api_headers,
verify=CHECK_CERTIFICATE, verify=CHECK_CERTIFICATE,
) )
@ -255,8 +257,8 @@ def test_formsemestre_etudiants(api_headers):
formsemestre_etus = r_defaillants.json() formsemestre_etus = r_defaillants.json()
assert isinstance(formsemestre_etus, list) assert isinstance(formsemestre_etus, list)
assert verify_fields(formsemestre_etus, FORMSEMESTRE_ETUS_FIELDS) is True
for etu in formsemestre_etus: for etu in formsemestre_etus:
assert verify_fields(etu, FORMSEMESTRE_ETUS_FIELDS) is True
assert isinstance(etu["id"], int) assert isinstance(etu["id"], int)
assert isinstance(etu["nip"], str) assert isinstance(etu["nip"], str)
assert isinstance(etu["ine"], str) assert isinstance(etu["ine"], str)
@ -279,7 +281,9 @@ def test_formsemestre_etudiants(api_headers):
assert isinstance(group["group_id"], int) assert isinstance(group["group_id"], int)
assert group["group_name"] is None or isinstance(group["group_name"], 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 ### ### ERROR ###
id_formsemestre_inexistant = 265165689619851621685 id_formsemestre_inexistant = 265165689619851621685

View File

@ -543,7 +543,7 @@ FORMSEMESTRE_ETUS_FIELDS = {
"nom", "nom",
"nom_usuel", "nom_usuel",
"prenom", "prenom",
"cvilite", "civilite",
"groups", "groups",
} }