Améliore/met à jour tests unitaires API

This commit is contained in:
Emmanuel Viennet 2024-04-11 06:00:00 +02:00
parent 41fec29452
commit beba69bfe4
3 changed files with 191 additions and 162 deletions

View File

@ -255,8 +255,20 @@ def test_etudiants_by_name(api_headers):
etuds = r.json()
assert etuds == []
#
admin_header = get_auth_headers(API_USER_ADMIN, API_PASSWORD_ADMIN)
args = {
"prenom": "Prénom",
"nom": "Réçier",
"dept": DEPT_ACRONYM,
"civilite": "X",
}
_ = POST_JSON(
"/etudiant/create",
args,
headers=admin_header,
)
r = requests.get(
API_URL + "/etudiants/name/REG",
API_URL + "/etudiants/name/REC",
headers=api_headers,
verify=CHECK_CERTIFICATE,
timeout=scu.SCO_TEST_API_TIMEOUT,
@ -264,7 +276,7 @@ def test_etudiants_by_name(api_headers):
assert r.status_code == 200
etuds = r.json()
assert len(etuds) == 1
assert etuds[0]["nom"] == "GNIER"
assert etuds[0]["nom"] == "ÇIER"
def test_etudiant_annotations(api_headers):

View File

@ -708,6 +708,7 @@ def test_formsemestre_resultat(api_headers):
"""
# Test brutal: compare les texts des json (après suppression des espaces et tabs)
# ce test cassera à la moindre modification :-)
# Pour regénérer le fichier de référence, récupérer venv/res.json
formsemestre_id = 1
r = requests.get(
f"{API_URL}/formsemestre/{formsemestre_id}/resultats",

View File

@ -4,13 +4,14 @@
"code_nip": "11",
"rang": "1",
"civilite_str": "Mme",
"nom_disp": "FLEURY",
"nom_disp": "BONHOMME",
"prenom": "MADELEINE",
"code_cursus": "S1",
"ues_validables": "3/3",
"nom_short": "BONHOMME Ma.",
"partitions": {
"1": 1
},
"sort_key": "bonhomme;madeleine",
"moy_gen": "14.36",
"nbabs": 5,
"nbabsjust": 1,
"moy_ue_1": "14.94",
"moy_res_1_1": "~",
"moy_res_3_1": "11.97",
@ -48,27 +49,28 @@
"moy_res_21_3": "~",
"moy_sae_14_3": "17.83",
"moy_sae_15_3": "~",
"ues_validables": "3/3",
"nbabs": 0,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"specialite": "",
"sort_key": "fleury;madeleine",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
},
{
"etudid": 8,
"code_nip": "NIP8",
"rang": "2",
"civilite_str": "M.",
"nom_disp": "SAUNIER",
"nom_disp": "JAMES",
"prenom": "JACQUES",
"code_cursus": "S1",
"ues_validables": "3/3",
"nom_short": "JAMES Ja.",
"partitions": {
"1": 1
},
"sort_key": "james;jacques",
"moy_gen": "12.67",
"nbabs": 3,
"nbabsjust": 1,
"moy_ue_1": "13.51",
"moy_res_1_1": "~",
"moy_res_3_1": "03.27",
@ -106,27 +108,28 @@
"moy_res_21_3": "~",
"moy_sae_14_3": "10.74",
"moy_sae_15_3": "~",
"ues_validables": "3/3",
"nbabs": 2,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"specialite": "",
"sort_key": "saunier;jacques",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
},
{
"etudid": 6,
"code_nip": "NIP6",
"rang": "3",
"civilite_str": "",
"nom_disp": "LENFANT",
"nom_disp": "THIBAUD",
"prenom": "MAXIME",
"code_cursus": "S1",
"ues_validables": "2/3",
"nom_short": "THIBAUD Ma.",
"partitions": {
"1": 1
},
"sort_key": "thibaud;maxime",
"moy_gen": "12.02",
"nbabs": 0,
"nbabsjust": 0,
"moy_ue_1": "14.34",
"moy_res_1_1": "~",
"moy_res_3_1": "17.68",
@ -164,27 +167,28 @@
"moy_res_21_3": "~",
"moy_sae_14_3": "05.70",
"moy_sae_15_3": "~",
"ues_validables": "2/3",
"nbabs": 0,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"sort_key": "lenfant;maxime",
"specialite": "",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
},
{
"etudid": 7,
"code_nip": "7",
"rang": "4",
"civilite_str": "",
"nom_disp": "CUNY",
"nom_disp": "ROYER",
"prenom": "CAMILLE",
"code_cursus": "S1",
"ues_validables": "2/3",
"nom_short": "ROYER Ca.",
"partitions": {
"1": 1
},
"sort_key": "royer;camille",
"moy_gen": "11.88",
"nbabs": 4,
"nbabsjust": 4,
"moy_ue_1": "07.09",
"moy_res_1_1": "~",
"moy_res_3_1": "04.07",
@ -222,27 +226,28 @@
"moy_res_21_3": "~",
"moy_sae_14_3": "10.52",
"moy_sae_15_3": "~",
"ues_validables": "2/3",
"nbabs": 0,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"specialite": "",
"sort_key": "cuny;camille",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
},
{
"etudid": 12,
"code_nip": "NIP12",
"rang": "5",
"civilite_str": "M.",
"nom_disp": "MOUTON",
"nom_disp": "GODIN",
"prenom": "CLAUDE",
"code_cursus": "S1",
"ues_validables": "1/3",
"nom_short": "GODIN Cl.",
"partitions": {
"1": 1
},
"sort_key": "godin;claude",
"moy_gen": "10.52",
"nbabs": 1,
"nbabsjust": 0,
"moy_ue_1": "08.93",
"moy_res_1_1": "~",
"moy_res_3_1": "07.77",
@ -280,27 +285,28 @@
"moy_res_21_3": "~",
"moy_sae_14_3": "11.09",
"moy_sae_15_3": "~",
"ues_validables": "1/3",
"nbabs": 3,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"sort_key": "mouton;claude",
"specialite": "",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
},
{
"etudid": 3,
"code_nip": "3",
"rang": "6",
"civilite_str": "M.",
"nom_disp": "R\u00c9GNIER",
"nom_disp": "CONSTANT",
"prenom": "PATRICK",
"code_cursus": "S1",
"ues_validables": "2/3",
"nom_short": "CONSTANT Pa.",
"partitions": {
"1": 1
},
"sort_key": "constant;patrick",
"moy_gen": "10.04",
"nbabs": 0,
"nbabsjust": 0,
"moy_ue_1": "13.06",
"moy_res_1_1": "~",
"moy_res_3_1": "05.84",
@ -338,27 +344,28 @@
"moy_res_21_3": "~",
"moy_sae_14_3": "01.55",
"moy_sae_15_3": "~",
"ues_validables": "2/3",
"nbabs": 0,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"specialite": "",
"sort_key": "regnier;patrick",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
},
{
"etudid": 13,
"code_nip": "13",
"rang": "7",
"civilite_str": "",
"nom_disp": "ESTEVE",
"nom_disp": "TOUSSAINT",
"prenom": "ALIX",
"code_cursus": "S1",
"ues_validables": "1/3",
"nom_short": "TOUSSAINT Al.",
"partitions": {
"1": 1
},
"sort_key": "toussaint;alix",
"moy_gen": "08.59",
"nbabs": 0,
"nbabsjust": 0,
"moy_ue_1": "07.24",
"moy_res_1_1": "~",
"moy_res_3_1": "11.90",
@ -396,27 +403,28 @@
"moy_res_21_3": "~",
"moy_sae_14_3": "05.17",
"moy_sae_15_3": "~",
"ues_validables": "1/3",
"nbabs": 3,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"sort_key": "esteve;alix",
"specialite": "",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
},
{
"etudid": 16,
"code_nip": "NIP16",
"rang": "8",
"civilite_str": "",
"nom_disp": "GILLES",
"nom_disp": "DENIS",
"prenom": "MAXIME",
"code_cursus": "S1",
"ues_validables": "0/3",
"nom_short": "DENIS Ma.",
"partitions": {
"1": 1
},
"sort_key": "denis;maxime",
"moy_gen": "07.21",
"nbabs": 1,
"nbabsjust": 1,
"moy_ue_1": "06.86",
"moy_res_1_1": "~",
"moy_res_3_1": "~",
@ -454,27 +462,28 @@
"moy_res_21_3": "~",
"moy_sae_14_3": "03.32",
"moy_sae_15_3": "~",
"ues_validables": "0/3",
"nbabs": 0,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"sort_key": "gilles;maxime",
"specialite": "",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
},
{
"etudid": 2,
"code_nip": "NIP2",
"rang": "9",
"civilite_str": "Mme",
"nom_disp": "NAUDIN",
"nom_disp": "WALTER",
"prenom": "SIMONE",
"code_cursus": "S1",
"ues_validables": "0/3",
"nom_short": "WALTER Si.",
"partitions": {
"1": 1
},
"sort_key": "walter;simone",
"moy_gen": "07.02",
"nbabs": 5,
"nbabsjust": 3,
"moy_ue_1": "06.82",
"moy_res_1_1": "~",
"moy_res_3_1": "16.91",
@ -512,27 +521,28 @@
"moy_res_21_3": "~",
"moy_sae_14_3": "02.10",
"moy_sae_15_3": "~",
"ues_validables": "0/3",
"nbabs": 0,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"sort_key": "naudin;simone",
"specialite": "",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
},
{
"etudid": 1,
"code_nip": "1",
"rang": "10",
"civilite_str": "",
"nom_disp": "COSTA",
"nom_disp": "GROSS",
"prenom": "SACHA",
"code_cursus": "S1",
"ues_validables": "0/3",
"nom_short": "GROSS Sa.",
"partitions": {
"1": 1
},
"sort_key": "gross;sacha",
"moy_gen": "05.31",
"nbabs": 2,
"nbabsjust": 1,
"moy_ue_1": "03.73",
"moy_res_1_1": "~",
"moy_res_3_1": "~",
@ -570,27 +580,28 @@
"moy_res_21_3": "~",
"moy_sae_14_3": "07.17",
"moy_sae_15_3": "~",
"ues_validables": "0/3",
"nbabs": 0,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"sort_key": "costa;sacha",
"specialite": "",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
},
{
"etudid": 4,
"code_nip": "NIP4",
"rang": "11 ex",
"civilite_str": "M.",
"nom_disp": "GAUTIER",
"nom_disp": "BARTHELEMY",
"prenom": "G\u00c9RARD",
"code_cursus": "S1",
"ues_validables": "",
"nom_short": "BARTHELEMY G\u00e9.",
"partitions": {
"1": 1
},
"sort_key": "barthelemy;gerard",
"moy_gen": "",
"nbabs": 3,
"nbabsjust": 1,
"moy_ue_1": "",
"moy_res_1_1": "",
"moy_res_3_1": "",
@ -628,27 +639,28 @@
"moy_res_21_3": "",
"moy_sae_14_3": "",
"moy_sae_15_3": "",
"ues_validables": "",
"nbabs": 2,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"sort_key": "gautier;gerard",
"specialite": "",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
},
{
"etudid": 5,
"code_nip": "5",
"rang": "11 ex",
"civilite_str": "Mme",
"nom_disp": "VILLENEUVE",
"nom_disp": "MILLOT",
"prenom": "FRAN\u00c7OISE",
"code_cursus": "S1",
"ues_validables": "",
"nom_short": "MILLOT Fr.",
"partitions": {
"1": 1
},
"sort_key": "millot;francoise",
"moy_gen": "",
"nbabs": 0,
"nbabsjust": 0,
"moy_ue_1": "",
"moy_res_1_1": "",
"moy_res_3_1": "",
@ -686,27 +698,28 @@
"moy_res_21_3": "",
"moy_sae_14_3": "",
"moy_sae_15_3": "",
"ues_validables": "",
"nbabs": 2,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"sort_key": "villeneuve;francoise",
"specialite": "",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
},
{
"etudid": 9,
"code_nip": "9",
"rang": "11 ex",
"civilite_str": "M.",
"nom_disp": "SCHMITT",
"nom_disp": "BENOIT",
"prenom": "EMMANUEL",
"code_cursus": "S1",
"ues_validables": "",
"nom_short": "BENOIT Em.",
"partitions": {
"1": 1
},
"sort_key": "benoit;emmanuel",
"moy_gen": "",
"nbabs": 0,
"nbabsjust": 0,
"moy_ue_1": "",
"moy_res_1_1": "",
"moy_res_3_1": "",
@ -744,27 +757,28 @@
"moy_res_21_3": "",
"moy_sae_14_3": "",
"moy_sae_15_3": "",
"ues_validables": "",
"nbabs": 0,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"sort_key": "schmitt;emmanuel",
"specialite": "",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
},
{
"etudid": 10,
"code_nip": "NIP10",
"rang": "11 ex",
"civilite_str": "Mme",
"nom_disp": "BOUTET",
"nom_disp": "LECOCQ",
"prenom": "MARGUERITE",
"code_cursus": "S1",
"ues_validables": "",
"nom_short": "LECOCQ Ma.",
"partitions": {
"1": 1
},
"sort_key": "lecocq;marguerite",
"moy_gen": "",
"nbabs": 0,
"nbabsjust": 0,
"moy_ue_1": "",
"moy_res_1_1": "",
"moy_res_3_1": "",
@ -802,27 +816,28 @@
"moy_res_21_3": "",
"moy_sae_14_3": "",
"moy_sae_15_3": "",
"ues_validables": "",
"nbabs": 1,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"sort_key": "boutet;marguerite",
"specialite": "",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
},
{
"etudid": 14,
"code_nip": "NIP14",
"rang": "11 ex",
"civilite_str": "M.",
"nom_disp": "ROLLIN",
"nom_disp": "ROUSSET",
"prenom": "DERC'HEN",
"code_cursus": "S1",
"ues_validables": "",
"nom_short": "ROUSSET De.",
"partitions": {
"1": 1
},
"sort_key": "rousset;derchen",
"moy_gen": "",
"nbabs": 0,
"nbabsjust": 0,
"moy_ue_1": "",
"moy_res_1_1": "",
"moy_res_3_1": "",
@ -860,27 +875,28 @@
"moy_res_21_3": "",
"moy_sae_14_3": "",
"moy_sae_15_3": "",
"ues_validables": "",
"nbabs": 0,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"specialite": "",
"sort_key": "rollin;derchen",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
},
{
"etudid": 15,
"code_nip": "15",
"rang": "11 ex",
"civilite_str": "",
"nom_disp": "DIOT",
"nom_disp": "MORAND",
"prenom": "CAMILLE",
"code_cursus": "S1",
"ues_validables": "",
"nom_short": "MORAND Ca.",
"partitions": {
"1": 1
},
"sort_key": "morand;camille",
"moy_gen": "",
"nbabs": 4,
"nbabsjust": 2,
"moy_ue_1": "",
"moy_res_1_1": "",
"moy_res_3_1": "",
@ -918,13 +934,13 @@
"moy_res_21_3": "",
"moy_sae_14_3": "",
"moy_sae_15_3": "",
"ues_validables": "",
"nbabs": 0,
"nbabsjust": 0,
"code_cursus": "S1",
"bac": "",
"sort_key": "diot;camille",
"specialite": "",
"type_admission": "",
"classement": "",
"partitions": {
"1": 1
}
"classement": ""
}
]