1
0
forked from ScoDoc/ScoDoc

tests departement

This commit is contained in:
leonard_montalbano 2022-05-11 16:17:43 +02:00
parent dd3bea414d
commit c4fce43b1a
3 changed files with 35 additions and 33 deletions

View File

@ -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:

View File

@ -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

View File

@ -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",