Merge pull request 'fix tests api (date courante, changement dans les champs réponses)' (#517) from jmplace/ScoDoc-Lille:fix_tests_api into master

Reviewed-on: https://scodoc.org/git/ScoDoc/ScoDoc/pulls/517
This commit is contained in:
Emmanuel Viennet 2022-11-01 17:33:35 +01:00
commit 6109bac729
4 changed files with 26 additions and 15 deletions

View File

@ -242,7 +242,7 @@ def test_semestres_courant(api_headers):
# Accès via acronyme
r = requests.get(
f"{API_URL}/departement/{dept['acronym']}/formsemestres_courants",
f"{API_URL}/departement/{dept['acronym']}/formsemestres_courants?date_courante=2022-07-01",
headers=api_headers,
verify=CHECK_CERTIFICATE,
)
@ -251,7 +251,7 @@ def test_semestres_courant(api_headers):
# accès via dept_id
r = requests.get(
f"{API_URL}/departement/id/{dept['id']}/formsemestres_courants",
f"{API_URL}/departement/id/{dept['id']}/formsemestres_courants?date_courante=2022-07-01",
headers=api_headers,
verify=CHECK_CERTIFICATE,
)

View File

@ -66,7 +66,7 @@ def test_etudiants_courant(api_headers):
fields = {"id", "code_nip", "nom", "prenom", "civilite"}
r = requests.get(
API_URL + "/etudiants/courants",
API_URL + "/etudiants/courants?date_courante=2022-07-01",
headers=api_headers,
verify=CHECK_CERTIFICATE,
)
@ -87,7 +87,7 @@ def test_etudiants_courant(api_headers):
########## Version long ################
r = requests.get(
API_URL + "/etudiants/courants/long",
API_URL + "/etudiants/courants/long?date_courante=2022-07-01",
headers=api_headers,
verify=CHECK_CERTIFICATE,
)
@ -308,7 +308,7 @@ def test_etudiant_bulletin_semestre(api_headers):
)
assert r.status_code == 200
bulletin = r.json()
assert len(bulletin) == 13 # HARDCODED
assert len(bulletin) == 14 # HARDCODED
assert verify_fields(bulletin, BULLETIN_FIELDS) is True
assert isinstance(bulletin["version"], str)
@ -324,6 +324,7 @@ def test_etudiant_bulletin_semestre(api_headers):
assert isinstance(bulletin["saes"], dict)
assert isinstance(bulletin["ues"], dict)
assert isinstance(bulletin["semestre"], dict)
assert isinstance(bulletin["ues_capitalisees"], dict)
bulletin_etud = bulletin["etudiant"]
assert verify_fields(bulletin_etud, BULLETIN_ETUDIANT_FIELDS) is True
@ -637,7 +638,7 @@ def test_etudiant_bulletin_semestre(api_headers):
)
assert r.status_code == 200
bul = r.json()
assert len(bul) == 13 # HARDCODED
assert len(bul) == 14 # HARDCODED
######### Test code ine #########
r = requests.get(
@ -647,7 +648,7 @@ def test_etudiant_bulletin_semestre(api_headers):
)
assert r.status_code == 200
bul = r.json()
assert len(bul) == 13 # HARDCODED
assert len(bul) == 14 # HARDCODED
################### LONG + PDF #####################
@ -687,7 +688,7 @@ def test_etudiant_bulletin_semestre(api_headers):
)
assert r.status_code == 200
bul = r.json()
assert len(bul) == 13 # HARDCODED
assert len(bul) == 14 # HARDCODED
######### Test code nip #########
@ -698,7 +699,7 @@ def test_etudiant_bulletin_semestre(api_headers):
)
assert r.status_code == 200
bul = r.json()
assert len(bul) == 13 # HARDCODED
assert len(bul) == 14 # HARDCODED
######### Test code ine #########
r = requests.get(
@ -708,7 +709,7 @@ def test_etudiant_bulletin_semestre(api_headers):
)
assert r.status_code == 200
bul = r.json()
assert len(bul) == 13 # HARDCODED
assert len(bul) == 14 # HARDCODED
################### SHORT + PDF #####################

View File

@ -618,8 +618,12 @@ def test_etat_evals(api_headers):
assert evaluation["description"] is None or isinstance(
evaluation["description"], str
)
assert evaluation["jour"] is None or isinstance(evaluation["jour"], str)
assert isinstance(evaluation["heure_fin"], str)
assert evaluation["date_debut"] is None or isinstance(
evaluation["date_debut"], str
)
assert evaluation["date_fin"] is None or isinstance(
evaluation["date_fin"], str
)
assert isinstance(evaluation["coefficient"], float)
assert isinstance(evaluation["etat"], dict)
assert isinstance(evaluation["nb_inscrits"], int)

View File

@ -478,10 +478,16 @@ BULLETIN_SEMESTRE_RANG_FIELDS = {"value", "total"}
EVAL_FIELDS = {
"id",
"description",
"jour",
"heure_debut",
"heure_fin",
"date_debut",
"date_fin",
"coefficient",
"evaluation_type",
"moduleimpl_id",
"note_max",
"numero",
"poids",
"publish_incomplete",
"visi_bulletin",
"etat",
"nb_inscrits",
"nb_notes_manquantes",