1
0
forked from ScoDoc/ScoDoc

tests unitaires formsemestre + ajout des fields à tests dans tools_test_api.py

This commit is contained in:
leonard_montalbano 2022-06-15 16:03:31 +02:00
parent 281539dd3b
commit 3a3c3793ed
2 changed files with 124 additions and 62 deletions

View File

@ -49,44 +49,19 @@ def test_formsemestre(api_headers):
assert verify_fields(formsemestre, FSEM_FIELDS) assert verify_fields(formsemestre, FSEM_FIELDS)
def test_etudiant_bulletin(api_headers): # XXX TODO ajouter une etape_apo dans la base de test
""" # def test_formsemestre_apo(api_headers):
Route: # r = requests.get(
""" # API_URL + "/formation/apo/<string:etape_apo>",
formsemestre_id = 1 # headers=api_headers,
r = requests.get( # verify=CHECK_CERTIFICATE,
f"{API_URL}/etudiant/etudid/1/formsemestre/{formsemestre_id}/bulletin", # )
headers=api_headers, # assert r.status_code == 200
verify=CHECK_CERTIFICATE,
)
assert r.status_code == 200
bull_a = r.json()
r = requests.get(
f"{API_URL}/etudiant/nip/{NIP}/formsemestre/{formsemestre_id}/bulletin",
headers=api_headers,
verify=CHECK_CERTIFICATE,
)
assert r.status_code == 200
bull_b = r.json()
r = requests.get(
f"{API_URL}/etudiant/ine/{INE}/formsemestre/{formsemestre_id}/bulletin",
headers=api_headers,
verify=CHECK_CERTIFICATE,
)
assert r.status_code == 200
bull_c = r.json()
# elimine les dates de publication pour comparer les autres champs
del bull_a["date"]
del bull_b["date"]
del bull_c["date"]
assert bull_a == bull_b == bull_c
def test_bulletins(api_headers): def test_bulletins(api_headers):
""" """
Route: Route: /formsemestre/<int:formsemestre_id>/bulletins
""" """
r = requests.get( r = requests.get(
API_URL + "/formsemestre/1/bulletins", API_URL + "/formsemestre/1/bulletins",
@ -106,6 +81,32 @@ def test_bulletins(api_headers):
# assert r.status_code == 200 # assert r.status_code == 200
# def test_formsemestre_etudiants(api_headers):
# """
# Route: /formsemestre/<int:formsemestre_id>/etudiants, /formsemestre/<int:formsemestre_id>/etudiants/demissionnaires, /formsemestre/<int:formsemestre_id>/etudiants/defaillants
# """
# r = requests.get(
# API_URL + "/formsemestre/<int:formsemestre_id>/etudiants",
# headers=api_headers,
# verify=CHECK_CERTIFICATE,
# )
# assert r.status_code == 200
#
# r = requests.get(
# API_URL + "/formsemestre/<int:formsemestre_id>/etudiants/demissionnaires",
# headers=api_headers,
# verify=CHECK_CERTIFICATE,
# )
# assert r.status_code == 200
#
# r = requests.get(
# API_URL + "/formsemestre/<int:formsemestre_id>/etudiants/defaillants",
# headers=api_headers,
# verify=CHECK_CERTIFICATE,
# )
# assert r.status_code == 200
def test_formsemestre_programme(api_headers): def test_formsemestre_programme(api_headers):
""" """
Route: /formsemestre/1/programme Route: /formsemestre/1/programme
@ -138,32 +139,6 @@ def test_formsemestre_programme(api_headers):
assert verify_fields(sae, MODIMPL_FIELDS) assert verify_fields(sae, MODIMPL_FIELDS)
# def test_formsemestre_etudiants(api_headers):
# """
# Route: /formsemestre/<int:formsemestre_id>/etudiants, /formsemestre/<int:formsemestre_id>/etudiants/demissionnaires, /formsemestre/<int:formsemestre_id>/etudiants/defaillants
# """
# r = requests.get(
# API_URL + "/formsemestre/<int:formsemestre_id>/etudiants",
# headers=api_headers,
# verify=CHECK_CERTIFICATE,
# )
# assert r.status_code == 200
#
# r = requests.get(
# API_URL + "/formsemestre/<int:formsemestre_id>/etudiants/demissionnaires",
# headers=api_headers,
# verify=CHECK_CERTIFICATE,
# )
# assert r.status_code == 200
#
# r = requests.get(
# API_URL + "/formsemestre/<int:formsemestre_id>/etudiants/defaillants",
# headers=api_headers,
# verify=CHECK_CERTIFICATE,
# )
# assert r.status_code == 200
def test_etat_evals( def test_etat_evals(
api_headers, api_headers,
): ):

View File

@ -78,12 +78,12 @@ ETUD_FIELDS = {
} }
FORMATION_FIELDS = { FORMATION_FIELDS = {
"id", "dept_id",
"acronyme", "acronyme",
"titre_officiel", "titre_officiel",
"formation_code", "formation_code",
"code_specialite", "code_specialite",
"dept_id", "id",
"titre", "titre",
"version", "version",
"type_parcours", "type_parcours",
@ -91,6 +91,63 @@ FORMATION_FIELDS = {
"formation_id", "formation_id",
} }
FORMATION_EXPORT_FIELDS = {
"dept_id",
"acronyme",
"titre_officiel",
"formation_code",
"code_specialite",
"id",
"titre",
"version",
"type_parcours",
"referentiel_competence_id",
"formation_id",
"ue",
}
FORMATION_EXPORT_UE_FIELDS = {
"acronyme",
"numero",
"titre",
"type",
"ue_code",
"ects",
"is_external",
"code_apogee",
"coefficient",
"semestre_idx",
"color",
"reference",
"matiere",
}
FORMATION_EXPORT_UE_MATIERE_FIELDS = {
"titre",
"numero",
"module",
}
FORMATION_EXPORT_UE_MATIERE_MODULE_FIELDS = {
"titre",
"abbrev",
"code",
"heures_cours",
"heures_td",
"coefficient",
"ects",
"semestre_id",
"numero",
"code_apogee",
"module_type",
"coefficients",
}
FORMATION_EXPORT_UE_MATIERE_MODULE_COEF_FIELDS = {
"ue_reference",
"coef",
}
FORMSEMESTRE_FIELDS = [ FORMSEMESTRE_FIELDS = [
"titre", "titre",
"gestion_semestrielle", "gestion_semestrielle",
@ -432,3 +489,33 @@ BULLETIN_SEMESTRE_ECTS_FIELDS = {"acquis", "total"}
BULLETIN_SEMESTRE_NOTES_FIELDS = {"value", "min", "moy", "max"} BULLETIN_SEMESTRE_NOTES_FIELDS = {"value", "min", "moy", "max"}
BULLETIN_SEMESTRE_RANG_FIELDS = {"value", "total"} BULLETIN_SEMESTRE_RANG_FIELDS = {"value", "total"}
EVAL_FIELDS = {
"id",
"description",
"datetime_epreuve",
"heure_fin",
"coefficient",
"comptee",
"inscrits",
"manquantes",
"ABS",
"ATT",
"EXC",
"saisie_notes",
}
SAISIE_NOTES_FIELDS = {"datetime_debut", "datetime_fin", "datetime_mediane"}
ABSENCES_FIELDS = {
"jour",
"matin",
"estabs",
"estjust",
"description",
"begin",
"end",
}
ABSENCES_GROUP_ETAT_FIELDS = {"etudid", "list_abs"}