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() etuds = r.json()
assert etuds == [] 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( r = requests.get(
API_URL + "/etudiants/name/REG", API_URL + "/etudiants/name/REC",
headers=api_headers, headers=api_headers,
verify=CHECK_CERTIFICATE, verify=CHECK_CERTIFICATE,
timeout=scu.SCO_TEST_API_TIMEOUT, timeout=scu.SCO_TEST_API_TIMEOUT,
@ -264,7 +276,7 @@ def test_etudiants_by_name(api_headers):
assert r.status_code == 200 assert r.status_code == 200
etuds = r.json() etuds = r.json()
assert len(etuds) == 1 assert len(etuds) == 1
assert etuds[0]["nom"] == "GNIER" assert etuds[0]["nom"] == "ÇIER"
def test_etudiant_annotations(api_headers): 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) # Test brutal: compare les texts des json (après suppression des espaces et tabs)
# ce test cassera à la moindre modification :-) # 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 formsemestre_id = 1
r = requests.get( r = requests.get(
f"{API_URL}/formsemestre/{formsemestre_id}/resultats", f"{API_URL}/formsemestre/{formsemestre_id}/resultats",

View File

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