diff --git a/app/api/tools.py b/app/api/tools.py index e03d83344..72e98a3cc 100644 --- a/app/api/tools.py +++ b/app/api/tools.py @@ -1,6 +1,6 @@ from app import models - +### TODO Faire en sorte de renvoyer l'étudiant qui a son inscription la plus récente def get_etud_from_etudid_or_nip_or_ine( etudid=None, nip=None, ine=None ) -> models.Identite: diff --git a/tests/api/test_api_departements.py b/tests/api/test_api_departements.py index d0337530c..bd68fc03c 100644 --- a/tests/api/test_api_departements.py +++ b/tests/api/test_api_departements.py @@ -23,6 +23,7 @@ from tests.api.setup_test_api import API_URL, CHECK_CERTIFICATE, api_headers from tests.api.tools_test_api import ( verify_fields, DEPARTEMENT_FIELDS, + FORMSEMESTRE_FIELDS, verify_occurences_ids_etus, ) @@ -194,34 +195,6 @@ def test_list_etudiants(api_headers): # liste_semestres_courant def test_semestres_courant(api_headers): - fields = [ - "titre", - "gestion_semestrielle", - "scodoc7_id", - "date_debut", - "bul_bgcolor", - "date_fin", - "resp_can_edit", - "dept_id", - "etat", - "resp_can_change_ens", - "id", - "modalite", - "ens_can_edit_eval", - "formation_id", - "gestion_compensation", - "elt_sem_apo", - "semestre_id", - "bul_hide_xml", - "elt_annee_apo", - "block_moyennes", - "formsemestre_id", - "titre_num", - "titre_formation", - "date_debut_iso", - "date_fin_iso", - "responsables", - ] dept_id = 1 r = requests.get( f"{API_URL}/departement/{dept_id}", @@ -240,10 +213,6 @@ def test_semestres_courant(api_headers): ) assert r.status_code == 200 result_a = r.json() - assert isinstance(result_a, list) # liste de formsemestres - assert len(result_a) > 0 - sem = result_a[0] - assert verify_fields(sem, fields) is True # accès via dept_id r = requests.get( @@ -254,3 +223,7 @@ def test_semestres_courant(api_headers): assert r.status_code == 200 result_b = r.json() assert result_a == result_b + assert isinstance(result_a, list) # liste de formsemestres + assert len(result_a) > 0 + sem = result_a[0] + assert verify_fields(sem, FORMSEMESTRE_FIELDS) is True diff --git a/tests/api/tools_test_api.py b/tests/api/tools_test_api.py index 1d0c429d1..40d443810 100644 --- a/tests/api/tools_test_api.py +++ b/tests/api/tools_test_api.py @@ -82,6 +82,35 @@ FORMATION_FIELDS = { "formation_id", } +FORMSEMESTRE_FIELDS = [ + "titre", + "gestion_semestrielle", + "scodoc7_id", + "date_debut", + "bul_bgcolor", + "date_fin", + "resp_can_edit", + "dept_id", + "etat", + "resp_can_change_ens", + "id", + "modalite", + "ens_can_edit_eval", + "formation_id", + "gestion_compensation", + "elt_sem_apo", + "semestre_id", + "bul_hide_xml", + "elt_annee_apo", + "block_moyennes", + "formsemestre_id", + "titre_num", + "titre_formation", + "date_debut_iso", + "date_fin_iso", + "responsables", +] + FSEM_FIELDS = { "block_moyennes", "bul_bgcolor",