forked from ScoDoc/ScoDoc
Compare commits
4 Commits
bac99da726
...
a7cb96a9fc
Author | SHA1 | Date | |
---|---|---|---|
|
a7cb96a9fc | ||
|
ffd0782f8a | ||
94c91567ec | |||
f740ab8339 |
@ -187,117 +187,3 @@ def referenciel_competences(dept: str, formation_id: int):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return jsonify(ref_comp)
|
return jsonify(ref_comp)
|
||||||
|
|
||||||
|
|
||||||
@bp.route(
|
|
||||||
"/departements/<string:dept>/formsemestre/<string:formsemestre_id>/programme",
|
|
||||||
methods=["GET"],
|
|
||||||
)
|
|
||||||
@token_permission_required(Permission.APIView)
|
|
||||||
def semestre_index(dept: str, formsemestre_id: int):
|
|
||||||
"""
|
|
||||||
Retourne la liste des Ues, ressources et SAE d'un semestre
|
|
||||||
|
|
||||||
dept : l'acronym d'un département
|
|
||||||
formsemestre_id : l'id d'un formesemestre
|
|
||||||
|
|
||||||
Exemple de résultat :
|
|
||||||
{
|
|
||||||
"ues": [
|
|
||||||
{
|
|
||||||
"type": 0,
|
|
||||||
"formation_id": 1,
|
|
||||||
"ue_code": "UCOD11",
|
|
||||||
"id": 1,
|
|
||||||
"ects": 12.0,
|
|
||||||
"acronyme": "RT1.1",
|
|
||||||
"is_external": false,
|
|
||||||
"numero": 1,
|
|
||||||
"code_apogee": "",
|
|
||||||
"titre": "Administrer les r\u00e9seaux et l\u2019Internet",
|
|
||||||
"coefficient": 0.0,
|
|
||||||
"semestre_idx": 1,
|
|
||||||
"color": "#B80004",
|
|
||||||
"ue_id": 1
|
|
||||||
},
|
|
||||||
...
|
|
||||||
],
|
|
||||||
"ressources": [
|
|
||||||
{
|
|
||||||
"titre": "Fondamentaux de la programmation",
|
|
||||||
"coefficient": 1.0,
|
|
||||||
"module_type": 2,
|
|
||||||
"id": 17,
|
|
||||||
"ects": null,
|
|
||||||
"abbrev": null,
|
|
||||||
"ue_id": 3,
|
|
||||||
"code": "R107",
|
|
||||||
"formation_id": 1,
|
|
||||||
"heures_cours": 0.0,
|
|
||||||
"matiere_id": 3,
|
|
||||||
"heures_td": 0.0,
|
|
||||||
"semestre_id": 1,
|
|
||||||
"heures_tp": 0.0,
|
|
||||||
"numero": 70,
|
|
||||||
"code_apogee": "",
|
|
||||||
"module_id": 17
|
|
||||||
},
|
|
||||||
...
|
|
||||||
],
|
|
||||||
"saes": [
|
|
||||||
{
|
|
||||||
"titre": "Se pr\u00e9senter sur Internet",
|
|
||||||
"coefficient": 1.0,
|
|
||||||
"module_type": 3,
|
|
||||||
"id": 14,
|
|
||||||
"ects": null,
|
|
||||||
"abbrev": null,
|
|
||||||
"ue_id": 3,
|
|
||||||
"code": "SAE14",
|
|
||||||
"formation_id": 1,
|
|
||||||
"heures_cours": 0.0,
|
|
||||||
"matiere_id": 3,
|
|
||||||
"heures_td": 0.0,
|
|
||||||
"semestre_id": 1,
|
|
||||||
"heures_tp": 0.0,
|
|
||||||
"numero": 40,
|
|
||||||
"code_apogee": "",
|
|
||||||
"module_id": 14
|
|
||||||
},
|
|
||||||
...
|
|
||||||
]
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
|
||||||
app.set_sco_dept(dept)
|
|
||||||
|
|
||||||
formsemestre = models.FormSemestre.query.filter_by(
|
|
||||||
id=formsemestre_id
|
|
||||||
).first_or_404()
|
|
||||||
|
|
||||||
ues = formsemestre.query_ues()
|
|
||||||
|
|
||||||
ues_dict = []
|
|
||||||
ressources = []
|
|
||||||
saes = []
|
|
||||||
|
|
||||||
for ue in ues:
|
|
||||||
ues_dict.append(ue.to_dict())
|
|
||||||
ressources = ue.get_ressources()
|
|
||||||
saes = ue.get_saes()
|
|
||||||
|
|
||||||
data_ressources = []
|
|
||||||
for ressource in ressources:
|
|
||||||
data_ressources.append(ressource.to_dict())
|
|
||||||
|
|
||||||
data_saes = []
|
|
||||||
for sae in saes:
|
|
||||||
data_saes.append(sae.to_dict())
|
|
||||||
|
|
||||||
data = {
|
|
||||||
"ues": ues_dict,
|
|
||||||
"ressources": data_ressources,
|
|
||||||
"saes": data_saes,
|
|
||||||
}
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
@ -110,18 +110,17 @@ def formsemestre_apo(etape_apo: str):
|
|||||||
"/formsemestre/<int:formsemestre_id>/etudiant/etudid/<int:etudid>/bulletin",
|
"/formsemestre/<int:formsemestre_id>/etudiant/etudid/<int:etudid>/bulletin",
|
||||||
methods=["GET"],
|
methods=["GET"],
|
||||||
)
|
)
|
||||||
# @bp.route(
|
@bp.route(
|
||||||
# "/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/nip/<int:nip>/bulletin",
|
"/formsemestre/<int:formsemestre_id>/etudiant/nip/<int:nip>/bulletin",
|
||||||
# methods=["GET"],
|
methods=["GET"],
|
||||||
# )
|
)
|
||||||
# @bp.route(
|
@bp.route(
|
||||||
# "/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/ine/<int:ine>/bulletin",
|
"/formsemestre/<int:formsemestre_id>/etudiant/ine/<int:ine>/bulletin",
|
||||||
# methods=["GET"],
|
methods=["GET"],
|
||||||
# )
|
)
|
||||||
@token_permission_required(Permission.APIView)
|
@token_permission_required(Permission.APIView)
|
||||||
def etudiant_bulletin(
|
def etudiant_bulletin(
|
||||||
formsemestre_id,
|
formsemestre_id,
|
||||||
# dept,
|
|
||||||
etudid: int = None,
|
etudid: int = None,
|
||||||
nip: int = None,
|
nip: int = None,
|
||||||
ine: int = None,
|
ine: int = None,
|
||||||
|
@ -210,10 +210,17 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
) # la plus RECENTE en tête
|
) # la plus RECENTE en tête
|
||||||
|
|
||||||
#
|
#
|
||||||
caneditevals = sco_permissions_check.can_edit_notes(
|
sem_locked = not sem["etat"]
|
||||||
|
can_edit_evals = (
|
||||||
|
sco_permissions_check.can_edit_notes(
|
||||||
current_user, moduleimpl_id, allow_ens=sem["ens_can_edit_eval"]
|
current_user, moduleimpl_id, allow_ens=sem["ens_can_edit_eval"]
|
||||||
)
|
)
|
||||||
caneditnotes = sco_permissions_check.can_edit_notes(current_user, moduleimpl_id)
|
and not sem_locked
|
||||||
|
)
|
||||||
|
can_edit_notes = (
|
||||||
|
sco_permissions_check.can_edit_notes(current_user, moduleimpl_id)
|
||||||
|
and not sem_locked
|
||||||
|
)
|
||||||
arrow_up, arrow_down, arrow_none = sco_groups.get_arrow_icons_tags()
|
arrow_up, arrow_down, arrow_none = sco_groups.get_arrow_icons_tags()
|
||||||
#
|
#
|
||||||
module_resp = User.query.get(M["responsable_id"])
|
module_resp = User.query.get(M["responsable_id"])
|
||||||
@ -264,7 +271,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
H.append("""Semestre: </td><td>%s""" % sem["semestre_id"])
|
H.append("""Semestre: </td><td>%s""" % sem["semestre_id"])
|
||||||
else:
|
else:
|
||||||
H.append("""</td><td>""")
|
H.append("""</td><td>""")
|
||||||
if not sem["etat"]:
|
if sem_locked:
|
||||||
H.append(scu.icontag("lock32_img", title="verrouillé"))
|
H.append(scu.icontag("lock32_img", title="verrouillé"))
|
||||||
H.append("""</td><td class="fichetitre2">""")
|
H.append("""</td><td class="fichetitre2">""")
|
||||||
if modimpl.module.is_apc():
|
if modimpl.module.is_apc():
|
||||||
@ -385,13 +392,15 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
|
|
||||||
# -------- Tableau des evaluations
|
# -------- Tableau des evaluations
|
||||||
top_table_links = ""
|
top_table_links = ""
|
||||||
if sem["etat"]: # non verrouillé
|
if can_edit_evals:
|
||||||
top_table_links = (
|
top_table_links = f"""<a class="stdlink" href="{
|
||||||
"""<a class="stdlink" href="evaluation_create?moduleimpl_id=%(moduleimpl_id)s">Créer nouvelle évaluation</a>
|
url_for("notes.evaluation_create", scodoc_dept=g.scodoc_dept, moduleimpl_id=M['moduleimpl_id'])
|
||||||
<a class="stdlink" style="margin-left:2em;" href="module_evaluation_renumber?moduleimpl_id=%(moduleimpl_id)s&redirect=1">Trier par date</a>
|
}">Créer nouvelle évaluation</a>
|
||||||
|
<a class="stdlink" style="margin-left:2em;" href="{
|
||||||
|
url_for("notes.module_evaluation_renumber", scodoc_dept=g.scodoc_dept, moduleimpl_id=M['moduleimpl_id'],
|
||||||
|
redirect=1)
|
||||||
|
}">Trier par date</a>
|
||||||
"""
|
"""
|
||||||
% M
|
|
||||||
)
|
|
||||||
if mod_evals:
|
if mod_evals:
|
||||||
H.append(
|
H.append(
|
||||||
'<div class="moduleimpl_evaluations_top_links">'
|
'<div class="moduleimpl_evaluations_top_links">'
|
||||||
@ -451,14 +460,14 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
)
|
)
|
||||||
# Fleches:
|
# Fleches:
|
||||||
H.append('<span class="eval_arrows_chld">')
|
H.append('<span class="eval_arrows_chld">')
|
||||||
if eval_index != (len(mod_evals) - 1) and caneditevals:
|
if eval_index != (len(mod_evals) - 1) and can_edit_evals:
|
||||||
H.append(
|
H.append(
|
||||||
'<a href="module_evaluation_move?evaluation_id=%s&after=0" class="aud">%s</a>'
|
'<a href="module_evaluation_move?evaluation_id=%s&after=0" class="aud">%s</a>'
|
||||||
% (eval["evaluation_id"], arrow_up)
|
% (eval["evaluation_id"], arrow_up)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
H.append(arrow_none)
|
H.append(arrow_none)
|
||||||
if (eval_index > 0) and caneditevals:
|
if (eval_index > 0) and can_edit_evals:
|
||||||
H.append(
|
H.append(
|
||||||
'<a href="module_evaluation_move?evaluation_id=%s&after=1" class="aud">%s</a>'
|
'<a href="module_evaluation_move?evaluation_id=%s&after=1" class="aud">%s</a>'
|
||||||
% (eval["evaluation_id"], arrow_down)
|
% (eval["evaluation_id"], arrow_down)
|
||||||
@ -487,7 +496,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
etat_descr = "il manque des notes"
|
etat_descr = "il manque des notes"
|
||||||
else:
|
else:
|
||||||
etat_txt = ""
|
etat_txt = ""
|
||||||
if caneditevals and etat_txt:
|
if can_edit_evals and etat_txt:
|
||||||
etat_txt = (
|
etat_txt = (
|
||||||
'<a href="evaluation_edit?evaluation_id=%s" title="%s">%s</a>'
|
'<a href="evaluation_edit?evaluation_id=%s" title="%s">%s</a>'
|
||||||
% (eval["evaluation_id"], etat_descr, etat_txt)
|
% (eval["evaluation_id"], etat_descr, etat_txt)
|
||||||
@ -496,7 +505,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
H.append("""</th></tr>""")
|
H.append("""</th></tr>""")
|
||||||
|
|
||||||
H.append("""<tr class="%s"><td class="mievr">""" % tr_class)
|
H.append("""<tr class="%s"><td class="mievr">""" % tr_class)
|
||||||
if caneditevals:
|
if can_edit_evals:
|
||||||
H.append(
|
H.append(
|
||||||
"""<a class="smallbutton" href="evaluation_edit?evaluation_id=%s">%s</a>"""
|
"""<a class="smallbutton" href="evaluation_edit?evaluation_id=%s">%s</a>"""
|
||||||
% (
|
% (
|
||||||
@ -506,7 +515,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if caneditnotes:
|
if can_edit_notes:
|
||||||
H.append(
|
H.append(
|
||||||
"""<a class="smallbutton" href="saisie_notes?evaluation_id=%s">%s</a>"""
|
"""<a class="smallbutton" href="saisie_notes?evaluation_id=%s">%s</a>"""
|
||||||
% (
|
% (
|
||||||
@ -517,13 +526,13 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
if etat["nb_notes"] == 0:
|
if etat["nb_notes"] == 0:
|
||||||
if caneditevals:
|
if can_edit_evals:
|
||||||
H.append(
|
H.append(
|
||||||
"""<a class="smallbutton" href="evaluation_delete?evaluation_id=%(evaluation_id)s">"""
|
"""<a class="smallbutton" href="evaluation_delete?evaluation_id=%(evaluation_id)s">"""
|
||||||
% eval
|
% eval
|
||||||
)
|
)
|
||||||
H.append(scu.icontag("delete_img", alt="supprimer", title="Supprimer"))
|
H.append(scu.icontag("delete_img", alt="supprimer", title="Supprimer"))
|
||||||
if caneditevals:
|
if can_edit_evals:
|
||||||
H.append("""</a>""")
|
H.append("""</a>""")
|
||||||
elif etat["evalcomplete"]:
|
elif etat["evalcomplete"]:
|
||||||
H.append(
|
H.append(
|
||||||
@ -561,7 +570,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
else:
|
else:
|
||||||
H.append(" ")
|
H.append(" ")
|
||||||
H.append('</td><td class="mievr_menu">')
|
H.append('</td><td class="mievr_menu">')
|
||||||
if caneditnotes:
|
if can_edit_notes:
|
||||||
H.append(
|
H.append(
|
||||||
moduleimpl_evaluation_menu(
|
moduleimpl_evaluation_menu(
|
||||||
eval["evaluation_id"],
|
eval["evaluation_id"],
|
||||||
@ -644,7 +653,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
H.append(""")""")
|
H.append(""")""")
|
||||||
if gr_moyenne["group_id"] in etat["gr_incomplets"]:
|
if gr_moyenne["group_id"] in etat["gr_incomplets"]:
|
||||||
H.append("""[<font color="red">""")
|
H.append("""[<font color="red">""")
|
||||||
if caneditnotes:
|
if can_edit_notes:
|
||||||
H.append(
|
H.append(
|
||||||
"""<a class="redlink" href="saisie_notes?evaluation_id=%s&group_ids:list=%s">incomplet</a></font>]"""
|
"""<a class="redlink" href="saisie_notes?evaluation_id=%s&group_ids:list=%s">incomplet</a></font>]"""
|
||||||
% (eval["evaluation_id"], gr_moyenne["group_id"])
|
% (eval["evaluation_id"], gr_moyenne["group_id"])
|
||||||
@ -653,24 +662,24 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
|||||||
H.append("""incomplet</font>]""")
|
H.append("""incomplet</font>]""")
|
||||||
else:
|
else:
|
||||||
H.append("""<span class="redboldtext"> """)
|
H.append("""<span class="redboldtext"> """)
|
||||||
if caneditnotes:
|
if can_edit_notes:
|
||||||
H.append(
|
H.append(
|
||||||
"""<a class="redlink" href="saisie_notes?evaluation_id=%s&group_ids:list=%s">"""
|
"""<a class="redlink" href="saisie_notes?evaluation_id=%s&group_ids:list=%s">"""
|
||||||
% (eval["evaluation_id"], gr_moyenne["group_id"])
|
% (eval["evaluation_id"], gr_moyenne["group_id"])
|
||||||
)
|
)
|
||||||
H.append("pas de notes")
|
H.append("pas de notes")
|
||||||
if caneditnotes:
|
if can_edit_notes:
|
||||||
H.append("""</a>""")
|
H.append("""</a>""")
|
||||||
H.append("</span>")
|
H.append("</span>")
|
||||||
H.append("""</td></tr>""")
|
H.append("""</td></tr>""")
|
||||||
first_eval = False
|
first_eval = False
|
||||||
|
|
||||||
#
|
#
|
||||||
if caneditevals or not sem["etat"]:
|
|
||||||
H.append("""<tr><td colspan="8">""")
|
H.append("""<tr><td colspan="8">""")
|
||||||
if not sem["etat"]:
|
if sem_locked:
|
||||||
H.append("""%s semestre verrouillé""" % scu.icontag("lock32_img"))
|
H.append(f"""{scu.icontag("lock32_img")} semestre verrouillé""")
|
||||||
else:
|
elif can_edit_evals:
|
||||||
H.append(top_table_links)
|
H.append(top_table_links)
|
||||||
|
|
||||||
H.append(
|
H.append(
|
||||||
|
@ -21,9 +21,18 @@ import requests
|
|||||||
|
|
||||||
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||||
|
|
||||||
|
from tests.api.tools_test_api import verify_fields
|
||||||
|
|
||||||
# departements
|
# departements
|
||||||
def test_departements(): #XXX TODO pour Seb
|
def test_departements():
|
||||||
|
fields = [
|
||||||
|
"id",
|
||||||
|
"acronym",
|
||||||
|
"description",
|
||||||
|
"visible",
|
||||||
|
"date_creation",
|
||||||
|
]
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/departements",
|
SCODOC_URL + "/ScoDoc/api/departements",
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
@ -32,35 +41,114 @@ def test_departements(): #XXX TODO pour Seb
|
|||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 1
|
assert len(r.json()) == 1
|
||||||
|
|
||||||
|
dept = r.json()[0]
|
||||||
|
|
||||||
|
fields_OK = verify_fields(dept, fields)
|
||||||
|
|
||||||
|
assert fields_OK is True
|
||||||
|
|
||||||
|
|
||||||
# liste_etudiants
|
# liste_etudiants
|
||||||
def test_liste_etudiants(): #XXX TODO pour Seb
|
def test_liste_etudiants():
|
||||||
|
fields = [
|
||||||
|
"civilite",
|
||||||
|
"code_ine",
|
||||||
|
"code_nip",
|
||||||
|
"date_naissance",
|
||||||
|
"email",
|
||||||
|
"emailperso",
|
||||||
|
"etudid",
|
||||||
|
"nom",
|
||||||
|
"prenom",
|
||||||
|
"nomprenom",
|
||||||
|
"lieu_naissance",
|
||||||
|
"dept_naissance",
|
||||||
|
"nationalite",
|
||||||
|
"boursier",
|
||||||
|
"id",
|
||||||
|
"codepostaldomicile",
|
||||||
|
"paysdomicile",
|
||||||
|
"telephonemobile",
|
||||||
|
"typeadresse",
|
||||||
|
"domicile",
|
||||||
|
"villedomicile",
|
||||||
|
"telephone",
|
||||||
|
"fax",
|
||||||
|
"description",
|
||||||
|
]
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/departements/TAPI/etudiants/liste",
|
SCODOC_URL + "/ScoDoc/api/departements/TAPI/etudiants/liste",
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
etu = r.json()[0]
|
||||||
|
|
||||||
|
fields_OK = verify_fields(etu, fields)
|
||||||
|
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 16
|
assert len(r.json()) == 16
|
||||||
|
assert fields_OK is True
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/departements/TAPI/etudiants/liste/1",
|
SCODOC_URL + "/ScoDoc/api/departements/TAPI/etudiants/liste/1",
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
etu = r.json()[0]
|
||||||
|
|
||||||
|
fields_OK = verify_fields(etu, fields)
|
||||||
|
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 16
|
assert len(r.json()) == 16
|
||||||
|
assert fields_OK is True
|
||||||
|
|
||||||
|
|
||||||
# liste_semestres_courant
|
# liste_semestres_courant
|
||||||
def test_semestres_courant(): #XXX TODO pour Seb
|
def test_semestres_courant():
|
||||||
|
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",
|
||||||
|
"date_debut_iso",
|
||||||
|
"date_fin_iso",
|
||||||
|
"responsables",
|
||||||
|
]
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/departements/TAPI/semestres_courants",
|
SCODOC_URL + "/ScoDoc/api/departements/TAPI/semestres_courants",
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
sem = r.json()[0]
|
||||||
|
|
||||||
|
fields_OK = verify_fields(sem, fields)
|
||||||
|
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 1
|
assert len(r.json()) == 1
|
||||||
|
assert fields_OK is True
|
||||||
|
|
||||||
|
|
||||||
# referenciel_competences
|
# referenciel_competences
|
||||||
@ -72,94 +160,3 @@ def test_referenciel_competences():
|
|||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
assert r.status_code == 200 or 204
|
assert r.status_code == 200 or 204
|
||||||
|
|
||||||
|
|
||||||
# semestre_index
|
|
||||||
def test_semestre_index(): #XXX TODO pour Seb
|
|
||||||
|
|
||||||
ue_fields = [
|
|
||||||
"semestre_idx",
|
|
||||||
"type",
|
|
||||||
"formation_id",
|
|
||||||
"ue_code",
|
|
||||||
"id",
|
|
||||||
"ects",
|
|
||||||
"acronyme",
|
|
||||||
"is_external",
|
|
||||||
"numero",
|
|
||||||
"code_apogee",
|
|
||||||
"titre",
|
|
||||||
"coefficient",
|
|
||||||
"color",
|
|
||||||
"ue_id",
|
|
||||||
]
|
|
||||||
|
|
||||||
ressource_fields = [
|
|
||||||
"heures_tp",
|
|
||||||
"code_apogee",
|
|
||||||
"titre",
|
|
||||||
"coefficient",
|
|
||||||
"module_type",
|
|
||||||
"id",
|
|
||||||
"ects",
|
|
||||||
"abbrev",
|
|
||||||
"ue_id",
|
|
||||||
"code",
|
|
||||||
"formation_id",
|
|
||||||
"heures_cours",
|
|
||||||
"matiere_id",
|
|
||||||
"heures_td",
|
|
||||||
"semestre_id",
|
|
||||||
"numero",
|
|
||||||
"module_id",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
sae_fields = [
|
|
||||||
"heures_tp",
|
|
||||||
"code_apogee",
|
|
||||||
"titre",
|
|
||||||
"coefficient",
|
|
||||||
"module_type",
|
|
||||||
"id",
|
|
||||||
"ects",
|
|
||||||
"abbrev",
|
|
||||||
"ue_id",
|
|
||||||
"code",
|
|
||||||
"formation_id",
|
|
||||||
"heures_cours",
|
|
||||||
"matiere_id",
|
|
||||||
"heures_td",
|
|
||||||
"semestre_id",
|
|
||||||
"numero",
|
|
||||||
"module_id",
|
|
||||||
]
|
|
||||||
|
|
||||||
r = requests.get(
|
|
||||||
SCODOC_URL + "/ScoDoc/api/departements/TAPI/formsemestre/1/programme",
|
|
||||||
headers=HEADERS,
|
|
||||||
verify=CHECK_CERTIFICATE,
|
|
||||||
)
|
|
||||||
assert r.status_code == 200
|
|
||||||
assert len(r.json()) == 3
|
|
||||||
|
|
||||||
ue = r.json()["ues"][0]
|
|
||||||
ressource = r.json()["ressources"][0]
|
|
||||||
sae = r.json()["saes"][0]
|
|
||||||
|
|
||||||
fields_OK = True
|
|
||||||
|
|
||||||
# Vérifie si tous les champs sont bien présents
|
|
||||||
for field in ue:
|
|
||||||
if field not in ue_fields:
|
|
||||||
fields_OK = False
|
|
||||||
|
|
||||||
for field in ressource:
|
|
||||||
if field not in ressource_fields:
|
|
||||||
fields_OK = False
|
|
||||||
|
|
||||||
for field in sae:
|
|
||||||
if field not in sae_fields:
|
|
||||||
fields_OK = False
|
|
||||||
|
|
||||||
assert fields_OK is True
|
|
||||||
|
@ -24,7 +24,10 @@ from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
|||||||
|
|
||||||
|
|
||||||
# etudiants_courant
|
# etudiants_courant
|
||||||
def test_etudiants_courant(): # XXX TODO pour Seb
|
from tests.api.tools_test_api import verify_fields
|
||||||
|
|
||||||
|
|
||||||
|
def test_etudiants_courant():
|
||||||
|
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
"id",
|
||||||
@ -46,12 +49,7 @@ def test_etudiants_courant(): # XXX TODO pour Seb
|
|||||||
# Choisis aléatoirement un étudiant dans la liste des étudiants
|
# Choisis aléatoirement un étudiant dans la liste des étudiants
|
||||||
etu = r.json()[randint(0, len(r.json())) - 1]
|
etu = r.json()[randint(0, len(r.json())) - 1]
|
||||||
|
|
||||||
fields_OK = True
|
fields_OK = verify_fields(etu, fields)
|
||||||
|
|
||||||
# Vérifie si tous les champs sont bien présents
|
|
||||||
for field in etu:
|
|
||||||
if field not in fields:
|
|
||||||
fields_OK = False
|
|
||||||
|
|
||||||
assert fields_OK is True
|
assert fields_OK is True
|
||||||
|
|
||||||
@ -95,18 +93,13 @@ def test_etudiants_courant(): # XXX TODO pour Seb
|
|||||||
# Choisis aléatoirement un étudiant dans la liste des étudiants
|
# Choisis aléatoirement un étudiant dans la liste des étudiants
|
||||||
etu = r.json()[randint(0, len(r.json())) - 1]
|
etu = r.json()[randint(0, len(r.json())) - 1]
|
||||||
|
|
||||||
fields_OK = True
|
fields_OK = verify_fields(etu, fields_long)
|
||||||
|
|
||||||
# Vérifie si tous les champs sont bien présents
|
|
||||||
for field in etu:
|
|
||||||
if field not in fields_long:
|
|
||||||
fields_OK = False
|
|
||||||
|
|
||||||
assert fields_OK is True
|
assert fields_OK is True
|
||||||
|
|
||||||
|
|
||||||
# etudiant
|
# etudiant
|
||||||
def test_etudiant(): # XXX TODO pour Seb
|
def test_etudiant():
|
||||||
|
|
||||||
fields = [
|
fields = [
|
||||||
"civilite",
|
"civilite",
|
||||||
@ -147,12 +140,7 @@ def test_etudiant(): # XXX TODO pour Seb
|
|||||||
|
|
||||||
etu = r.json()
|
etu = r.json()
|
||||||
|
|
||||||
fields_OK = True
|
fields_OK = verify_fields(etu, fields)
|
||||||
|
|
||||||
# Vérifie si tous les champs sont bien présents
|
|
||||||
for field in etu:
|
|
||||||
if field not in fields:
|
|
||||||
fields_OK = False
|
|
||||||
|
|
||||||
assert fields_OK is True
|
assert fields_OK is True
|
||||||
|
|
||||||
@ -168,12 +156,7 @@ def test_etudiant(): # XXX TODO pour Seb
|
|||||||
|
|
||||||
etu = r.json()
|
etu = r.json()
|
||||||
|
|
||||||
fields_OK = True
|
fields_OK = verify_fields(etu, fields)
|
||||||
|
|
||||||
# Vérifie si tous les champs sont bien présents
|
|
||||||
for field in etu:
|
|
||||||
if field not in fields:
|
|
||||||
fields_OK = False
|
|
||||||
|
|
||||||
assert fields_OK is True
|
assert fields_OK is True
|
||||||
|
|
||||||
@ -189,18 +172,13 @@ def test_etudiant(): # XXX TODO pour Seb
|
|||||||
|
|
||||||
etu = r.json()
|
etu = r.json()
|
||||||
|
|
||||||
fields_OK = True
|
fields_OK = verify_fields(etu, fields)
|
||||||
|
|
||||||
# Vérifie si tous les champs sont bien présents
|
|
||||||
for field in etu:
|
|
||||||
if field not in fields:
|
|
||||||
fields_OK = False
|
|
||||||
|
|
||||||
assert fields_OK is True
|
assert fields_OK is True
|
||||||
|
|
||||||
|
|
||||||
# etudiant_formsemestres
|
# etudiant_formsemestres
|
||||||
def test_etudiant_formsemestres(): # XXX TODO pour Seb
|
def test_etudiant_formsemestres():
|
||||||
|
|
||||||
fields = [
|
fields = [
|
||||||
"date_fin",
|
"date_fin",
|
||||||
@ -242,12 +220,7 @@ def test_etudiant_formsemestres(): # XXX TODO pour Seb
|
|||||||
|
|
||||||
formsemestre = r.json()[0]
|
formsemestre = r.json()[0]
|
||||||
|
|
||||||
fields_OK = True
|
fields_OK = verify_fields(formsemestre, fields)
|
||||||
|
|
||||||
# Vérifie si tous les champs sont bien présents
|
|
||||||
for field in formsemestre:
|
|
||||||
if field not in fields:
|
|
||||||
fields_OK = False
|
|
||||||
|
|
||||||
assert fields_OK is True
|
assert fields_OK is True
|
||||||
|
|
||||||
@ -263,12 +236,7 @@ def test_etudiant_formsemestres(): # XXX TODO pour Seb
|
|||||||
|
|
||||||
formsemestre = r.json()[0]
|
formsemestre = r.json()[0]
|
||||||
|
|
||||||
fields_OK = True
|
fields_OK = verify_fields(formsemestre, fields)
|
||||||
|
|
||||||
# Vérifie si tous les champs sont bien présents
|
|
||||||
for field in formsemestre:
|
|
||||||
if field not in fields:
|
|
||||||
fields_OK = False
|
|
||||||
|
|
||||||
assert fields_OK is True
|
assert fields_OK is True
|
||||||
|
|
||||||
@ -284,12 +252,7 @@ def test_etudiant_formsemestres(): # XXX TODO pour Seb
|
|||||||
|
|
||||||
formsemestre = r.json()[0]
|
formsemestre = r.json()[0]
|
||||||
|
|
||||||
fields_OK = True
|
fields_OK = verify_fields(formsemestre, fields)
|
||||||
|
|
||||||
# Vérifie si tous les champs sont bien présents
|
|
||||||
for field in formsemestre:
|
|
||||||
if field not in fields:
|
|
||||||
fields_OK = False
|
|
||||||
|
|
||||||
assert fields_OK is True
|
assert fields_OK is True
|
||||||
|
|
||||||
@ -297,24 +260,6 @@ def test_etudiant_formsemestres(): # XXX TODO pour Seb
|
|||||||
# etudiant_bulletin_semestre
|
# etudiant_bulletin_semestre
|
||||||
def test_etudiant_bulletin_semestre():
|
def test_etudiant_bulletin_semestre():
|
||||||
|
|
||||||
# fields = [
|
|
||||||
# "etudid",
|
|
||||||
# "formsemestre_id",
|
|
||||||
# "date",
|
|
||||||
# "publie",
|
|
||||||
# "etapes",
|
|
||||||
# "etudiant",
|
|
||||||
# "note",
|
|
||||||
# "rang",
|
|
||||||
# "rang_group",
|
|
||||||
# "note_max",
|
|
||||||
# "bonus_sport_culture",
|
|
||||||
# "ue",
|
|
||||||
# "ue_capitalisee",
|
|
||||||
# "absences",
|
|
||||||
# "appreciation",
|
|
||||||
# ]
|
|
||||||
|
|
||||||
######### Test etudid #########
|
######### Test etudid #########
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
@ -325,17 +270,6 @@ def test_etudiant_bulletin_semestre():
|
|||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 13
|
assert len(r.json()) == 13
|
||||||
|
|
||||||
# bulletin = r.json()
|
|
||||||
#
|
|
||||||
# fields_OK = True
|
|
||||||
#
|
|
||||||
# # Vérifie si tous les champs sont bien présents
|
|
||||||
# for field in bulletin:
|
|
||||||
# if field not in fields:
|
|
||||||
# fields_OK = False
|
|
||||||
#
|
|
||||||
# assert fields_OK is True
|
|
||||||
|
|
||||||
######### Test code nip #########
|
######### Test code nip #########
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
@ -346,17 +280,6 @@ def test_etudiant_bulletin_semestre():
|
|||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 13
|
assert len(r.json()) == 13
|
||||||
|
|
||||||
# bulletin = r.json()
|
|
||||||
#
|
|
||||||
# fields_OK = True
|
|
||||||
#
|
|
||||||
# # Vérifie si tous les champs sont bien présents
|
|
||||||
# for field in bulletin:
|
|
||||||
# if field not in fields:
|
|
||||||
# fields_OK = False
|
|
||||||
#
|
|
||||||
# assert fields_OK is True
|
|
||||||
|
|
||||||
######### Test code ine #########
|
######### Test code ine #########
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
@ -367,17 +290,6 @@ def test_etudiant_bulletin_semestre():
|
|||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 13
|
assert len(r.json()) == 13
|
||||||
|
|
||||||
# bulletin = r.json()
|
|
||||||
#
|
|
||||||
# fields_OK = True
|
|
||||||
#
|
|
||||||
# # Vérifie si tous les champs sont bien présents
|
|
||||||
# for field in bulletin:
|
|
||||||
# if field not in fields:
|
|
||||||
# fields_OK = False
|
|
||||||
#
|
|
||||||
# assert fields_OK is True
|
|
||||||
|
|
||||||
|
|
||||||
# etudiant_groups
|
# etudiant_groups
|
||||||
def test_etudiant_groups():
|
def test_etudiant_groups():
|
||||||
@ -406,12 +318,7 @@ def test_etudiant_groups():
|
|||||||
|
|
||||||
groups = r.json()[0]
|
groups = r.json()[0]
|
||||||
|
|
||||||
fields_OK = True
|
fields_OK = verify_fields(groups, fields)
|
||||||
|
|
||||||
# Vérifie si tous les champs sont bien présents
|
|
||||||
for field in groups:
|
|
||||||
if field not in fields:
|
|
||||||
fields_OK = False
|
|
||||||
|
|
||||||
assert fields_OK is True
|
assert fields_OK is True
|
||||||
|
|
||||||
@ -427,12 +334,7 @@ def test_etudiant_groups():
|
|||||||
|
|
||||||
groups = r.json()[0]
|
groups = r.json()[0]
|
||||||
|
|
||||||
fields_OK = True
|
fields_OK = verify_fields(groups, fields)
|
||||||
|
|
||||||
# Vérifie si tous les champs sont bien présents
|
|
||||||
for field in groups:
|
|
||||||
if field not in fields:
|
|
||||||
fields_OK = False
|
|
||||||
|
|
||||||
assert fields_OK is True
|
assert fields_OK is True
|
||||||
|
|
||||||
@ -448,11 +350,6 @@ def test_etudiant_groups():
|
|||||||
|
|
||||||
groups = r.json()[0]
|
groups = r.json()[0]
|
||||||
|
|
||||||
fields_OK = True
|
fields_OK = verify_fields(groups, fields)
|
||||||
|
|
||||||
# Vérifie si tous les champs sont bien présents
|
|
||||||
for field in groups:
|
|
||||||
if field not in fields:
|
|
||||||
fields_OK = False
|
|
||||||
|
|
||||||
assert fields_OK is True
|
assert fields_OK is True
|
||||||
|
@ -74,8 +74,7 @@ def test_moduleimpls():
|
|||||||
# moduleimpls_sem
|
# moduleimpls_sem
|
||||||
def test_moduleimpls_sem():
|
def test_moduleimpls_sem():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL
|
SCODOC_URL + "/ScoDoc/api/formations/moduleimpl/formsemestre/1/liste",
|
||||||
+ "/ScoDoc/api/formations/moduleimpl/formsemestre/1/liste",
|
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
|
@ -22,6 +22,9 @@ import requests
|
|||||||
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||||
|
|
||||||
# formsemestre
|
# formsemestre
|
||||||
|
from tests.api.tools_test_api import verify_fields
|
||||||
|
|
||||||
|
|
||||||
def test_formsemestre():
|
def test_formsemestre():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formsemestre/1",
|
SCODOC_URL + "/ScoDoc/api/formsemestre/1",
|
||||||
@ -60,37 +63,29 @@ def test_formsemestre():
|
|||||||
"responsables",
|
"responsables",
|
||||||
]
|
]
|
||||||
|
|
||||||
fields_OK = True
|
fields_OK = verify_fields(formsemestre, fields)
|
||||||
|
|
||||||
# Vérifie si tous les champs sont bien présents
|
|
||||||
for field in formsemestre:
|
|
||||||
if field not in fields:
|
|
||||||
fields_OK = False
|
|
||||||
|
|
||||||
assert fields_OK is True
|
assert fields_OK is True
|
||||||
|
|
||||||
|
|
||||||
# etudiant_bulletin
|
# etudiant_bulletin
|
||||||
def test_etudiant_bulletin(): #XXX TODO pour Seb
|
def test_etudiant_bulletin():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL
|
SCODOC_URL + "/ScoDoc/api/formsemestre/1/etudiant/etudid/1/bulletin",
|
||||||
+ "/ScoDoc/api/formsemestre/1/departements/TAPI/etudiant/etudid/1/bulletin",
|
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL
|
SCODOC_URL + "/ScoDoc/api/formsemestre/1/etudiant/nip/1/bulletin",
|
||||||
+ "/ScoDoc/api/formsemestre/1/departements/TAPI/etudiant/nip/1/bulletin",
|
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL
|
SCODOC_URL + "/ScoDoc/api/formsemestre/1/etudiant/ine/1/bulletin",
|
||||||
+ "/ScoDoc/api/formsemestre/1/departements/TAPI/etudiant/ine/1/bulletin",
|
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
@ -115,3 +110,83 @@ def test_bulletins():
|
|||||||
# verify=CHECK_CERTIFICATE,
|
# verify=CHECK_CERTIFICATE,
|
||||||
# )
|
# )
|
||||||
# assert r.status_code == 200
|
# assert r.status_code == 200
|
||||||
|
|
||||||
|
# semestre_index
|
||||||
|
def test_semestre_index():
|
||||||
|
|
||||||
|
ue_fields = [
|
||||||
|
"semestre_idx",
|
||||||
|
"type",
|
||||||
|
"formation_id",
|
||||||
|
"ue_code",
|
||||||
|
"id",
|
||||||
|
"ects",
|
||||||
|
"acronyme",
|
||||||
|
"is_external",
|
||||||
|
"numero",
|
||||||
|
"code_apogee",
|
||||||
|
"titre",
|
||||||
|
"coefficient",
|
||||||
|
"color",
|
||||||
|
"ue_id",
|
||||||
|
]
|
||||||
|
|
||||||
|
ressource_fields = [
|
||||||
|
"heures_tp",
|
||||||
|
"code_apogee",
|
||||||
|
"titre",
|
||||||
|
"coefficient",
|
||||||
|
"module_type",
|
||||||
|
"id",
|
||||||
|
"ects",
|
||||||
|
"abbrev",
|
||||||
|
"ue_id",
|
||||||
|
"code",
|
||||||
|
"formation_id",
|
||||||
|
"heures_cours",
|
||||||
|
"matiere_id",
|
||||||
|
"heures_td",
|
||||||
|
"semestre_id",
|
||||||
|
"numero",
|
||||||
|
"module_id",
|
||||||
|
]
|
||||||
|
|
||||||
|
sae_fields = [
|
||||||
|
"heures_tp",
|
||||||
|
"code_apogee",
|
||||||
|
"titre",
|
||||||
|
"coefficient",
|
||||||
|
"module_type",
|
||||||
|
"id",
|
||||||
|
"ects",
|
||||||
|
"abbrev",
|
||||||
|
"ue_id",
|
||||||
|
"code",
|
||||||
|
"formation_id",
|
||||||
|
"heures_cours",
|
||||||
|
"matiere_id",
|
||||||
|
"heures_td",
|
||||||
|
"semestre_id",
|
||||||
|
"numero",
|
||||||
|
"module_id",
|
||||||
|
]
|
||||||
|
|
||||||
|
r = requests.get(
|
||||||
|
SCODOC_URL + "/ScoDoc/api/formsemestre/1/programme",
|
||||||
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
|
assert r.status_code == 200
|
||||||
|
assert len(r.json()) == 3
|
||||||
|
|
||||||
|
ue = r.json()["ues"][0]
|
||||||
|
ressource = r.json()["ressources"][0]
|
||||||
|
sae = r.json()["saes"][0]
|
||||||
|
|
||||||
|
fields_ue_OK = verify_fields(ue, ue_fields)
|
||||||
|
fields_ressource_OK = verify_fields(ressource, ressource_fields)
|
||||||
|
fields_sae_OK = verify_fields(sae, sae_fields)
|
||||||
|
|
||||||
|
assert fields_ue_OK is True
|
||||||
|
assert fields_ressource_OK is True
|
||||||
|
assert fields_sae_OK is True
|
||||||
|
13
tests/api/tools_test_api.py
Normal file
13
tests/api/tools_test_api.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
def verify_fields(json_response, fields):
|
||||||
|
"""
|
||||||
|
Vérifie si les champs de la réponse json sont corrects
|
||||||
|
|
||||||
|
json_response : la réponse de la requête
|
||||||
|
fields : une liste avec l'ensemble des champs à vérifier
|
||||||
|
|
||||||
|
Retourne True ou False
|
||||||
|
"""
|
||||||
|
for field in json_response:
|
||||||
|
if field not in fields:
|
||||||
|
return False
|
||||||
|
return True
|
Loading…
Reference in New Issue
Block a user