From aec53d354317409bf734e9166921e9ad149e9004 Mon Sep 17 00:00:00 2001 From: Jean-Marie PLACE Date: Tue, 1 Nov 2022 17:24:26 +0100 Subject: [PATCH] =?UTF-8?q?fix=20tests=20api=20(date=20courante,=20changem?= =?UTF-8?q?ent=20dans=20les=20champs=20r=C3=A9ponses)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/api/test_api_departements.py | 4 ++-- tests/api/test_api_etudiants.py | 17 +++++++++-------- tests/api/test_api_formsemestre.py | 8 ++++++-- tests/api/tools_test_api.py | 12 +++++++++--- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/tests/api/test_api_departements.py b/tests/api/test_api_departements.py index 224cec03a..8571d6ac6 100644 --- a/tests/api/test_api_departements.py +++ b/tests/api/test_api_departements.py @@ -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, ) diff --git a/tests/api/test_api_etudiants.py b/tests/api/test_api_etudiants.py index b7ed4f47e..e0f7249ce 100644 --- a/tests/api/test_api_etudiants.py +++ b/tests/api/test_api_etudiants.py @@ -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 ##################### diff --git a/tests/api/test_api_formsemestre.py b/tests/api/test_api_formsemestre.py index f9d6e8629..edc5ff350 100644 --- a/tests/api/test_api_formsemestre.py +++ b/tests/api/test_api_formsemestre.py @@ -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) diff --git a/tests/api/tools_test_api.py b/tests/api/tools_test_api.py index e3b1158a8..6de79adea 100644 --- a/tests/api/tools_test_api.py +++ b/tests/api/tools_test_api.py @@ -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",