forked from ScoDoc/ScoDoc
Merge branch 'new_api' of https://scodoc.org/git/leonard.montalbano/ScoDoc
This commit is contained in:
commit
da58e6c18c
@ -93,7 +93,7 @@ def absences_just(etudid: int = None, nip: int = None, ine: int = None):
|
|||||||
"jour": "Fri, 15 Apr 2022 00:00:00 GMT",
|
"jour": "Fri, 15 Apr 2022 00:00:00 GMT",
|
||||||
"matin": false,
|
"matin": false,
|
||||||
"estabs": true,
|
"estabs": true,
|
||||||
"estjust": false,
|
"estjust": true,
|
||||||
"description": "",
|
"description": "",
|
||||||
"begin": "2022-04-15 12:00:00",
|
"begin": "2022-04-15 12:00:00",
|
||||||
"end": "2022-04-15 17:59:59"
|
"end": "2022-04-15 17:59:59"
|
||||||
@ -120,7 +120,11 @@ def absences_just(etudid: int = None, nip: int = None, ine: int = None):
|
|||||||
|
|
||||||
|
|
||||||
@bp.route(
|
@bp.route(
|
||||||
"/absences/abs_group_etat/?group_id=<int:group_id>&date_debut=date_debut&date_fin=date_fin",
|
"/absences/abs_group_etat/<int:group_id>",
|
||||||
|
methods=["GET"],
|
||||||
|
)
|
||||||
|
@bp.route(
|
||||||
|
"/absences/abs_group_etat/group_id/<int:group_id>/date_debut/<string:date_debut>/date_fin/<string:date_fin>",
|
||||||
methods=["GET"],
|
methods=["GET"],
|
||||||
)
|
)
|
||||||
@token_permission_required(Permission.APIView)
|
@token_permission_required(Permission.APIView)
|
||||||
|
@ -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
|
|
||||||
|
@ -22,31 +22,23 @@ def etudiants_courant(long=False):
|
|||||||
Retourne la liste des étudiants courant
|
Retourne la liste des étudiants courant
|
||||||
|
|
||||||
Exemple de résultat :
|
Exemple de résultat :
|
||||||
{
|
[
|
||||||
{
|
{
|
||||||
"civilite": "X",
|
"id": 1,
|
||||||
"code_ine": null,
|
"nip": 1,
|
||||||
"code_nip": null,
|
|
||||||
"date_naissance": null,
|
|
||||||
"email": null,
|
|
||||||
"emailperso": null,
|
|
||||||
"etudid": 18,
|
|
||||||
"nom": "MOREL",
|
"nom": "MOREL",
|
||||||
"prenom": "JACQUES"
|
"prenom": "JACQUES",
|
||||||
},
|
|
||||||
{
|
|
||||||
"civilite": "X",
|
"civilite": "X",
|
||||||
"code_ine": null,
|
},
|
||||||
"code_nip": null,
|
{
|
||||||
"date_naissance": null,
|
"id": 2,
|
||||||
"email": null,
|
"nip": 2,
|
||||||
"emailperso": null,
|
"nom": "GILLES",
|
||||||
"etudid": 19,
|
"prenom": "MAXIME",
|
||||||
"nom": "FOURNIER",
|
"civilite": "X",
|
||||||
"prenom": "ANNE"
|
},
|
||||||
},
|
...
|
||||||
...
|
]
|
||||||
}
|
|
||||||
"""
|
"""
|
||||||
# Récupération de tous les étudiants
|
# Récupération de tous les étudiants
|
||||||
etuds = Identite.query.filter(
|
etuds = Identite.query.filter(
|
||||||
@ -59,7 +51,7 @@ def etudiants_courant(long=False):
|
|||||||
data = [etud.to_dict_bul(include_urls=False) for etud in etuds]
|
data = [etud.to_dict_bul(include_urls=False) for etud in etuds]
|
||||||
else:
|
else:
|
||||||
data = [etud.to_dict_short() for etud in etuds]
|
data = [etud.to_dict_short() for etud in etuds]
|
||||||
|
print(jsonify(data))
|
||||||
return jsonify(data)
|
return jsonify(data)
|
||||||
|
|
||||||
|
|
||||||
@ -76,17 +68,32 @@ def etudiant(etudid: int = None, nip: int = None, ine: int = None):
|
|||||||
ine : le code ine d'un étudiant
|
ine : le code ine d'un étudiant
|
||||||
|
|
||||||
Exemple de résultat :
|
Exemple de résultat :
|
||||||
{
|
{
|
||||||
"civilite": "X",
|
"civilite": "X",
|
||||||
"code_ine": null,
|
"code_ine": "1",
|
||||||
"code_nip": null,
|
"code_nip": "1",
|
||||||
"date_naissance": null,
|
"date_naissance": "",
|
||||||
"email": null,
|
"email": "SACHA.COSTA@example.com",
|
||||||
"emailperso": null,
|
"emailperso": "",
|
||||||
"etudid": 18,
|
"etudid": 1,
|
||||||
"nom": "MOREL",
|
"nom": "COSTA",
|
||||||
"prenom": "JACQUES"
|
"prenom": "SACHA",
|
||||||
}
|
"nomprenom": "Sacha COSTA",
|
||||||
|
"lieu_naissance": "",
|
||||||
|
"dept_naissance": "",
|
||||||
|
"nationalite": "",
|
||||||
|
"boursier": "",
|
||||||
|
"id": 1,
|
||||||
|
"codepostaldomicile": "",
|
||||||
|
"paysdomicile": "",
|
||||||
|
"telephonemobile": "",
|
||||||
|
"typeadresse": "domicile",
|
||||||
|
"domicile": "",
|
||||||
|
"villedomicile": "",
|
||||||
|
"telephone": "",
|
||||||
|
"fax": "",
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
"""
|
"""
|
||||||
# Récupération de l'étudiant
|
# Récupération de l'étudiant
|
||||||
etud = get_etu_from_etudid_or_nip_or_ine(etudid, nip, ine)
|
etud = get_etu_from_etudid_or_nip_or_ine(etudid, nip, ine)
|
||||||
@ -110,38 +117,36 @@ def etudiant_formsemestres(etudid: int = None, nip: int = None, ine: int = None)
|
|||||||
ine : le code ine d'un étudiant
|
ine : le code ine d'un étudiant
|
||||||
|
|
||||||
Exemple de résultat :
|
Exemple de résultat :
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"titre": "master machine info",
|
"date_fin": "31/08/2022",
|
||||||
"gestion_semestrielle": false,
|
"resp_can_edit": false,
|
||||||
"date_debut": "01/09/2021",
|
"dept_id": 1,
|
||||||
"bul_bgcolor": null,
|
"etat": true,
|
||||||
"date_fin": "15/12/2022",
|
"resp_can_change_ens": true,
|
||||||
"resp_can_edit": false,
|
"id": 1,
|
||||||
"dept_id": 1,
|
"modalite": "FI",
|
||||||
"etat": true,
|
"ens_can_edit_eval": false,
|
||||||
"resp_can_change_ens": false,
|
"formation_id": 1,
|
||||||
"id": 1,
|
"gestion_compensation": false,
|
||||||
"modalite": "FI",
|
"elt_sem_apo": null,
|
||||||
"ens_can_edit_eval": false,
|
"semestre_id": 1,
|
||||||
"formation_id": 1,
|
"bul_hide_xml": false,
|
||||||
"gestion_compensation": false,
|
"elt_annee_apo": null,
|
||||||
"elt_sem_apo": null,
|
"titre": "Semestre test",
|
||||||
"semestre_id": 1,
|
"block_moyennes": false,
|
||||||
"bul_hide_xml": false,
|
"scodoc7_id": null,
|
||||||
"elt_annee_apo": null,
|
"date_debut": "01/09/2021",
|
||||||
"block_moyennes": false,
|
"gestion_semestrielle": false,
|
||||||
"formsemestre_id": 1,
|
"bul_bgcolor": "white",
|
||||||
"titre_num": "master machine info semestre 1",
|
"formsemestre_id": 1,
|
||||||
"date_debut_iso": "2021-09-01",
|
"titre_num": "Semestre test semestre 1",
|
||||||
"date_fin_iso": "2022-12-15",
|
"date_debut_iso": "2021-09-01",
|
||||||
"responsables": [
|
"date_fin_iso": "2022-08-31",
|
||||||
3,
|
"responsables": []
|
||||||
2
|
},
|
||||||
]
|
...
|
||||||
},
|
]
|
||||||
...
|
|
||||||
]
|
|
||||||
"""
|
"""
|
||||||
# Récupération de l'étudiant
|
# Récupération de l'étudiant
|
||||||
etud = get_etu_from_etudid_or_nip_or_ine(etudid, nip, ine)
|
etud = get_etu_from_etudid_or_nip_or_ine(etudid, nip, ine)
|
||||||
|
@ -62,27 +62,27 @@ def evaluation_notes(evaluation_id: int):
|
|||||||
evaluation_id : l'id d'une évaluation
|
evaluation_id : l'id d'une évaluation
|
||||||
|
|
||||||
Exemple de résultat :
|
Exemple de résultat :
|
||||||
{
|
{
|
||||||
"1": {
|
"1": {
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"etudid": 10,
|
"etudid": 10,
|
||||||
"evaluation_id": 1,
|
"evaluation_id": 1,
|
||||||
"value": 15.0,
|
"value": 15.0,
|
||||||
"comment": "",
|
"comment": "",
|
||||||
"date": "Wed, 20 Apr 2022 06:49:05 GMT",
|
"date": "Wed, 20 Apr 2022 06:49:05 GMT",
|
||||||
"uid": 2
|
"uid": 2
|
||||||
},
|
},
|
||||||
"2": {
|
"2": {
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"etudid": 1,
|
"etudid": 1,
|
||||||
"evaluation_id": 1,
|
"evaluation_id": 1,
|
||||||
"value": 12.0,
|
"value": 12.0,
|
||||||
"comment": "",
|
"comment": "",
|
||||||
"date": "Wed, 20 Apr 2022 06:49:06 GMT",
|
"date": "Wed, 20 Apr 2022 06:49:06 GMT",
|
||||||
"uid": 2
|
"uid": 2
|
||||||
},
|
},
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
# Fonction utilisée : app.scodoc.sco_evaluation_db.do_evaluation_get_all_notes()
|
# Fonction utilisée : app.scodoc.sco_evaluation_db.do_evaluation_get_all_notes()
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ def formations():
|
|||||||
},
|
},
|
||||||
...
|
...
|
||||||
]
|
]
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Récupération de toutes les formations
|
# Récupération de toutes les formations
|
||||||
list_formations = models.Formation.query.all()
|
list_formations = models.Formation.query.all()
|
||||||
@ -171,13 +170,12 @@ def formation_export_by_formation_id(formation_id: int, export_ids=False):
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Fonction utilité : app.scodoc.sco_formations.formation_export()
|
# Fonction utilité : app.scodoc.sco_formations.formation_export()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Utilisation de la fonction formation_export
|
# Utilisation de la fonction formation_export
|
||||||
data = formation_export(formation_id)
|
data = formation_export(formation_id, export_ids)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return error_response(
|
return error_response(
|
||||||
409,
|
409,
|
||||||
@ -190,17 +188,47 @@ def formation_export_by_formation_id(formation_id: int, export_ids=False):
|
|||||||
|
|
||||||
@bp.route("/formations/moduleimpl/<int:moduleimpl_id>", methods=["GET"])
|
@bp.route("/formations/moduleimpl/<int:moduleimpl_id>", methods=["GET"])
|
||||||
@token_permission_required(Permission.APIView)
|
@token_permission_required(Permission.APIView)
|
||||||
def moduleimpls(moduleimpl_id: int):
|
def moduleimpl(moduleimpl_id: int):
|
||||||
"""
|
"""
|
||||||
Retourne la liste des moduleimpl
|
Retourne un module moduleimpl en fonction de son id
|
||||||
|
|
||||||
moduleimpl_id : l'id d'un moduleimpl
|
moduleimpl_id : l'id d'un moduleimpl
|
||||||
|
|
||||||
|
Exemple de résultat :
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"formsemestre_id": 1,
|
||||||
|
"computation_expr": null,
|
||||||
|
"module_id": 1,
|
||||||
|
"responsable_id": 2,
|
||||||
|
"moduleimpl_id": 1,
|
||||||
|
"ens": [],
|
||||||
|
"module": {
|
||||||
|
"heures_tp": 0,
|
||||||
|
"code_apogee": "",
|
||||||
|
"titre": "Initiation aux réseaux informatiques",
|
||||||
|
"coefficient": 1,
|
||||||
|
"module_type": 2,
|
||||||
|
"id": 1,
|
||||||
|
"ects": null,
|
||||||
|
"abbrev": "Init aux réseaux informatiques",
|
||||||
|
"ue_id": 1,
|
||||||
|
"code": "R101",
|
||||||
|
"formation_id": 1,
|
||||||
|
"heures_cours": 0,
|
||||||
|
"matiere_id": 1,
|
||||||
|
"heures_td": 0,
|
||||||
|
"semestre_id": 1,
|
||||||
|
"numero": 10,
|
||||||
|
"module_id": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
"""
|
"""
|
||||||
# Récupération des tous les moduleimpl
|
# Récupération des tous les moduleimpl
|
||||||
list_moduleimpls = models.ModuleImpl.query.filter_by(id=moduleimpl_id)
|
moduleimpl = models.ModuleImpl.query.filter_by(id=moduleimpl_id).first_or_404()
|
||||||
|
|
||||||
# Mise en forme des données
|
# Mise en forme des données
|
||||||
data = [moduleimpl.to_dict() for moduleimpl in list_moduleimpls]
|
data = moduleimpl.to_dict()
|
||||||
|
|
||||||
return jsonify(data)
|
return jsonify(data)
|
||||||
|
|
||||||
@ -208,7 +236,7 @@ def moduleimpls(moduleimpl_id: int):
|
|||||||
@bp.route(
|
@bp.route(
|
||||||
"/formations/moduleimpl/formsemestre/<int:formsemestre_id>/liste",
|
"/formations/moduleimpl/formsemestre/<int:formsemestre_id>/liste",
|
||||||
methods=["GET"],
|
methods=["GET"],
|
||||||
) # XXX TODO penser à changer la route sur la doc
|
)
|
||||||
@token_permission_required(Permission.APIView)
|
@token_permission_required(Permission.APIView)
|
||||||
def moduleimpls_sem(formsemestre_id: int):
|
def moduleimpls_sem(formsemestre_id: int):
|
||||||
"""
|
"""
|
||||||
|
@ -68,6 +68,35 @@ def formsemestre_apo(etape_apo: str):
|
|||||||
Retourne les informations sur les formsemestres
|
Retourne les informations sur les formsemestres
|
||||||
|
|
||||||
etape_apo : l'id d'une étape apogée
|
etape_apo : l'id d'une étape apogée
|
||||||
|
|
||||||
|
Exemple de résultat :
|
||||||
|
{
|
||||||
|
"date_fin": "31/08/2022",
|
||||||
|
"resp_can_edit": false,
|
||||||
|
"dept_id": 1,
|
||||||
|
"etat": true,
|
||||||
|
"resp_can_change_ens": true,
|
||||||
|
"id": 1,
|
||||||
|
"modalite": "FI",
|
||||||
|
"ens_can_edit_eval": false,
|
||||||
|
"formation_id": 1,
|
||||||
|
"gestion_compensation": false,
|
||||||
|
"elt_sem_apo": null,
|
||||||
|
"semestre_id": 1,
|
||||||
|
"bul_hide_xml": false,
|
||||||
|
"elt_annee_apo": null,
|
||||||
|
"titre": "Semestre test",
|
||||||
|
"block_moyennes": false,
|
||||||
|
"scodoc7_id": null,
|
||||||
|
"date_debut": "01/09/2021",
|
||||||
|
"gestion_semestrielle": false,
|
||||||
|
"bul_bgcolor": "white",
|
||||||
|
"formsemestre_id": 1,
|
||||||
|
"titre_num": "Semestre test semestre 1",
|
||||||
|
"date_debut_iso": "2021-09-01",
|
||||||
|
"date_fin_iso": "2022-08-31",
|
||||||
|
"responsables": []
|
||||||
|
}
|
||||||
"""
|
"""
|
||||||
formsemestres = FormSemestre.query.filter(
|
formsemestres = FormSemestre.query.filter(
|
||||||
FormSemestreEtape.etape_apo == etape_apo,
|
FormSemestreEtape.etape_apo == etape_apo,
|
||||||
@ -78,21 +107,20 @@ def formsemestre_apo(etape_apo: str):
|
|||||||
|
|
||||||
|
|
||||||
@bp.route(
|
@bp.route(
|
||||||
"/formsemestre/<int:formsemestre_id>/departements/<string:dept>/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,
|
||||||
@ -212,7 +240,15 @@ def etudiant_bulletin(
|
|||||||
# Fonction utilisée : app.scodoc.sco_bulletins_json.make_json_formsemestre_bulletinetud()
|
# Fonction utilisée : app.scodoc.sco_bulletins_json.make_json_formsemestre_bulletinetud()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
app.set_sco_dept(dept)
|
formsemestre = models.FormSemestre.query.filter_by(
|
||||||
|
id=formsemestre_id
|
||||||
|
).first_or_404()
|
||||||
|
|
||||||
|
dept = models.Departement.query.filter_by(
|
||||||
|
id=formsemestre.dept_id
|
||||||
|
).first_or_404()
|
||||||
|
|
||||||
|
app.set_sco_dept(dept.acronym)
|
||||||
except:
|
except:
|
||||||
return error_response(
|
return error_response(
|
||||||
409,
|
409,
|
||||||
@ -470,3 +506,115 @@ def jury(formsemestre_id: int):
|
|||||||
# )
|
# )
|
||||||
|
|
||||||
return jsonify(data)
|
return jsonify(data)
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route(
|
||||||
|
"/formsemestre/<int:formsemestre_id>/programme",
|
||||||
|
methods=["GET"],
|
||||||
|
)
|
||||||
|
@token_permission_required(Permission.APIView)
|
||||||
|
def semestre_index(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
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
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
|
||||||
|
@ -121,13 +121,13 @@ def etud_in_group(group_id: int, etat=None):
|
|||||||
|
|
||||||
|
|
||||||
@bp.route(
|
@bp.route(
|
||||||
"/partitions/set_groups?partition_id=<int:partition_id>&groups_lists=<int:groups_lists>&"
|
"/partitions/set_groups/partition/<int:partition_id>/groups/<string:groups_id>/delete/<string:groups_to_delete>"
|
||||||
"groups_to_create=<int:groups_to_create>&groups_to_delete=<int:groups_to_delete>",
|
"/create/<string:groups_to_create>",
|
||||||
methods=["POST"],
|
methods=["POST"],
|
||||||
)
|
)
|
||||||
@token_permission_required(Permission.APIEtudChangeGroups)
|
@token_permission_required(Permission.APIEtudChangeGroups)
|
||||||
def set_groups(
|
def set_groups(
|
||||||
partition_id: int, groups_lists: int, groups_to_delete: int, groups_to_create: int
|
partition_id: int, groups_lists: str, groups_to_delete: str, groups_to_create: str
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Set les groups
|
Set les groups
|
||||||
|
@ -20,10 +20,18 @@ Utilisation :
|
|||||||
import requests
|
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,134 +40,122 @@ 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
|
||||||
def test_referenciel_competences():
|
def test_referenciel_competences():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL
|
SCODOC_URL
|
||||||
+ "/ScoDoc/api/departements/TAPI/formations/1/referentiel_competences",
|
+ "/ScoDoc/api/departements/TAPI/formations/1/referentiel_competences",
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
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
|
|
||||||
|
@ -21,63 +21,38 @@ from random import randint
|
|||||||
import requests
|
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
|
||||||
|
|
||||||
# # etudiants
|
|
||||||
# def test_etudiants():
|
|
||||||
#
|
|
||||||
# fields = [
|
|
||||||
# "civilite",
|
|
||||||
# "code_ine",
|
|
||||||
# "code_nip",
|
|
||||||
# "date_naissance",
|
|
||||||
# "email",
|
|
||||||
# "emailperso",
|
|
||||||
# "etudid",
|
|
||||||
# "nom",
|
|
||||||
# "prenom",
|
|
||||||
# "nomprenom",
|
|
||||||
# "lieu_naissance",
|
|
||||||
# "dept_naissance",
|
|
||||||
# "nationalite",
|
|
||||||
# "boursier",
|
|
||||||
# "id",
|
|
||||||
# "domicile",
|
|
||||||
# "villedomicile",
|
|
||||||
# "telephone",
|
|
||||||
# "fax",
|
|
||||||
# "description",
|
|
||||||
# "codepostaldomicile",
|
|
||||||
# "paysdomicile",
|
|
||||||
# "telephonemobile",
|
|
||||||
# "typeadresse",
|
|
||||||
# ]
|
|
||||||
#
|
|
||||||
# r = requests.get(
|
|
||||||
# SCODOC_URL + "/ScoDoc/api/etudiants",
|
|
||||||
# headers=HEADERS,
|
|
||||||
# verify=CHECK_CERTIFICATE,
|
|
||||||
# )
|
|
||||||
# assert r.status_code == 200
|
|
||||||
# assert len(r.json()) == 16
|
|
||||||
#
|
|
||||||
# # Choisis aléatoirement un étudiant dans la liste des étudiants
|
|
||||||
# etu = r.json()[randint(0, len(r.json())) - 1]
|
|
||||||
#
|
|
||||||
# fields_OK = True
|
|
||||||
#
|
|
||||||
# # 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
|
|
||||||
|
|
||||||
|
|
||||||
# etudiants_courant
|
# etudiants_courant
|
||||||
def test_etudiants_courant(): # XXX TODO pour Seb
|
def test_etudiants_courant():
|
||||||
|
|
||||||
fields = [
|
fields = [
|
||||||
|
"id",
|
||||||
|
"nip",
|
||||||
|
"nom",
|
||||||
|
"nom_usuel",
|
||||||
|
"prenom",
|
||||||
|
"civilite",
|
||||||
|
]
|
||||||
|
|
||||||
|
r = requests.get(
|
||||||
|
SCODOC_URL + "/ScoDoc/api/etudiants/courant",
|
||||||
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
|
assert r.status_code == 200
|
||||||
|
assert len(r.json()) == 16
|
||||||
|
|
||||||
|
# Choisis aléatoirement un étudiant dans la liste des étudiants
|
||||||
|
etu = r.json()[randint(0, len(r.json())) - 1]
|
||||||
|
|
||||||
|
fields_OK = verify_fields(etu, fields)
|
||||||
|
|
||||||
|
assert fields_OK is True
|
||||||
|
|
||||||
|
########## Version long################
|
||||||
|
|
||||||
|
fields_long = [
|
||||||
"civilite",
|
"civilite",
|
||||||
"code_ine",
|
"code_ine",
|
||||||
"code_nip",
|
"code_nip",
|
||||||
@ -93,19 +68,19 @@ def test_etudiants_courant(): # XXX TODO pour Seb
|
|||||||
"nationalite",
|
"nationalite",
|
||||||
"boursier",
|
"boursier",
|
||||||
"id",
|
"id",
|
||||||
|
"codepostaldomicile",
|
||||||
|
"paysdomicile",
|
||||||
|
"telephonemobile",
|
||||||
|
"typeadresse",
|
||||||
"domicile",
|
"domicile",
|
||||||
"villedomicile",
|
"villedomicile",
|
||||||
"telephone",
|
"telephone",
|
||||||
"fax",
|
"fax",
|
||||||
"description",
|
"description",
|
||||||
"codepostaldomicile",
|
|
||||||
"paysdomicile",
|
|
||||||
"telephonemobile",
|
|
||||||
"typeadresse",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/etudiants/courant",
|
SCODOC_URL + "/ScoDoc/api/etudiants/courant/long",
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
@ -115,18 +90,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:
|
|
||||||
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",
|
||||||
@ -167,12 +137,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
|
||||||
|
|
||||||
@ -188,12 +153,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
|
||||||
|
|
||||||
@ -209,18 +169,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",
|
||||||
@ -262,12 +217,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
|
||||||
|
|
||||||
@ -283,12 +233,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
|
||||||
|
|
||||||
@ -304,12 +249,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
|
||||||
|
|
||||||
@ -317,24 +257,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(
|
||||||
@ -345,17 +267,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(
|
||||||
@ -366,17 +277,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(
|
||||||
@ -387,17 +287,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():
|
||||||
@ -426,12 +315,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
|
||||||
|
|
||||||
@ -447,12 +331,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
|
||||||
|
|
||||||
@ -468,11 +347,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
|
||||||
|
@ -20,63 +20,162 @@ Utilisation :
|
|||||||
import requests
|
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
|
||||||
|
|
||||||
|
|
||||||
# formations
|
# formations
|
||||||
def test_formations():
|
def test_formations():
|
||||||
|
fields = [
|
||||||
|
"id",
|
||||||
|
"acronyme",
|
||||||
|
"titre_officiel",
|
||||||
|
"formation_code",
|
||||||
|
"code_specialite",
|
||||||
|
"dept_id",
|
||||||
|
"titre",
|
||||||
|
"version",
|
||||||
|
"type_parcours",
|
||||||
|
"referentiel_competence_id",
|
||||||
|
"formation_id",
|
||||||
|
]
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formations",
|
SCODOC_URL + "/ScoDoc/api/formations",
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
formation = r.json()[0]
|
||||||
|
|
||||||
|
fields_OK = verify_fields(formation, fields)
|
||||||
|
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
assert len(r.json()) == 1
|
||||||
|
assert fields_OK is True
|
||||||
|
|
||||||
|
|
||||||
# formations_by_id
|
# formations_by_id
|
||||||
def test_formations_by_id():
|
def test_formations_by_id():
|
||||||
|
fields = [
|
||||||
|
"id",
|
||||||
|
"acronyme",
|
||||||
|
"titre_officiel",
|
||||||
|
"formation_code",
|
||||||
|
"code_specialite",
|
||||||
|
"dept_id",
|
||||||
|
"titre",
|
||||||
|
"version",
|
||||||
|
"type_parcours",
|
||||||
|
"referentiel_competence_id",
|
||||||
|
"formation_id",
|
||||||
|
]
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formations/1",
|
SCODOC_URL + "/ScoDoc/api/formations/1",
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
formation = r.json()
|
||||||
|
|
||||||
|
fields_OK = verify_fields(formation, fields)
|
||||||
|
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
assert fields_OK is True
|
||||||
|
|
||||||
|
|
||||||
# formation_export_by_formation_id
|
# formation_export_by_formation_id
|
||||||
def test_formation_export_by_formation_id():
|
def test_formation_export_by_formation_id():
|
||||||
|
fields = [
|
||||||
|
"id",
|
||||||
|
"acronyme",
|
||||||
|
"titre_officiel",
|
||||||
|
"formation_code",
|
||||||
|
"code_specialite",
|
||||||
|
"dept_id",
|
||||||
|
"titre",
|
||||||
|
"version",
|
||||||
|
"type_parcours",
|
||||||
|
"referentiel_competence_id",
|
||||||
|
"formation_id",
|
||||||
|
"ue",
|
||||||
|
]
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formations/formation_export/1",
|
SCODOC_URL + "/ScoDoc/api/formations/formation_export/1",
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
export_formation = r.json()
|
||||||
|
|
||||||
|
fields_OK = verify_fields(export_formation, fields)
|
||||||
|
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
assert fields_OK is True
|
||||||
|
|
||||||
|
|
||||||
# formsemestre_apo
|
# formsemestre_apo
|
||||||
def test_formsemestre_apo():
|
# def test_formsemestre_apo():
|
||||||
|
# r = requests.get(
|
||||||
|
# SCODOC_URL + "/ScoDoc/api/formations/apo/<string:etape_apo>",
|
||||||
|
# headers=HEADERS,
|
||||||
|
# verify=CHECK_CERTIFICATE,
|
||||||
|
# )
|
||||||
|
# assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
|
# moduleimpl
|
||||||
|
def test_moduleimpl():
|
||||||
|
|
||||||
|
fields = [
|
||||||
|
"id",
|
||||||
|
"formsemestre_id",
|
||||||
|
"computation_expr",
|
||||||
|
"module_id",
|
||||||
|
"responsable_id",
|
||||||
|
"moduleimpl_id",
|
||||||
|
"ens",
|
||||||
|
"module",
|
||||||
|
]
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formations/apo/<string:etape_apo>",
|
SCODOC_URL + "/ScoDoc/api/formations/moduleimpl/1",
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
assert r.status_code == 200
|
|
||||||
|
|
||||||
|
moduleimpl = r.json()
|
||||||
|
|
||||||
|
fields_OK = verify_fields(moduleimpl, fields)
|
||||||
|
|
||||||
# moduleimpls
|
|
||||||
def test_moduleimpls():
|
|
||||||
r = requests.get(
|
|
||||||
SCODOC_URL + "/ScoDoc/api/formations/moduleimpl/<int:moduleimpl_id>",
|
|
||||||
headers=HEADERS,
|
|
||||||
verify=CHECK_CERTIFICATE,
|
|
||||||
)
|
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
assert fields_OK is True
|
||||||
|
|
||||||
|
|
||||||
# moduleimpls_sem
|
# moduleimpls_sem
|
||||||
def test_moduleimpls_sem():
|
def test_moduleimpls_sem():
|
||||||
|
|
||||||
|
fields = [
|
||||||
|
"id",
|
||||||
|
"formsemestre_id",
|
||||||
|
"computation_expr",
|
||||||
|
"module_id",
|
||||||
|
"responsable_id",
|
||||||
|
"moduleimpl_id",
|
||||||
|
"ens",
|
||||||
|
"module",
|
||||||
|
"moduleimpl_id",
|
||||||
|
"ens",
|
||||||
|
]
|
||||||
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,
|
||||||
)
|
)
|
||||||
|
moduleimpl = r.json()[0]
|
||||||
|
|
||||||
|
fields_OK = verify_fields(moduleimpl, fields)
|
||||||
|
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
assert len(r.json()) == 21
|
||||||
|
assert fields_OK is True
|
||||||
|
@ -20,6 +20,7 @@ Utilisation :
|
|||||||
import requests
|
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
|
||||||
|
|
||||||
# formsemestre
|
# formsemestre
|
||||||
def test_formsemestre():
|
def test_formsemestre():
|
||||||
@ -60,37 +61,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 +108,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
|
||||||
|
@ -20,40 +20,105 @@ Utilisation :
|
|||||||
import requests
|
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
|
||||||
|
|
||||||
|
|
||||||
# partition
|
# partition
|
||||||
def test_partition():
|
def test_partition():
|
||||||
|
fields = [
|
||||||
|
"partition_id",
|
||||||
|
"id",
|
||||||
|
"formsemestre_id",
|
||||||
|
"partition_name",
|
||||||
|
"numero",
|
||||||
|
"bul_show_rank",
|
||||||
|
"show_in_lists",
|
||||||
|
]
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/partitions/1",
|
SCODOC_URL + "/ScoDoc/api/partitions/1",
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
partition = r.json()[0]
|
||||||
|
|
||||||
|
fields_OK = verify_fields(partition, fields)
|
||||||
|
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
assert len(r.json()) == 2
|
||||||
|
assert fields_OK is True
|
||||||
|
|
||||||
|
|
||||||
# etud_in_group
|
# etud_in_group
|
||||||
def test_etud_in_group():
|
def test_etud_in_group():
|
||||||
|
|
||||||
|
fields = [
|
||||||
|
"etudid",
|
||||||
|
"id",
|
||||||
|
"dept_id",
|
||||||
|
"nom",
|
||||||
|
"prenom",
|
||||||
|
"nom_usuel",
|
||||||
|
"civilite",
|
||||||
|
"date_naissance",
|
||||||
|
"lieu_naissance",
|
||||||
|
"dept_naissance",
|
||||||
|
"nationalite",
|
||||||
|
"statut",
|
||||||
|
"boursier",
|
||||||
|
"photo_filename",
|
||||||
|
"code_nip",
|
||||||
|
"code_ine",
|
||||||
|
"scodoc7_id",
|
||||||
|
"email",
|
||||||
|
"emailperso",
|
||||||
|
"domicile",
|
||||||
|
"codepostaldomicile",
|
||||||
|
"villedomicile",
|
||||||
|
"paysdomicile",
|
||||||
|
"telephone",
|
||||||
|
"telephonemobile",
|
||||||
|
"fax",
|
||||||
|
"typeadresse",
|
||||||
|
"description",
|
||||||
|
"group_id",
|
||||||
|
"etat",
|
||||||
|
"civilite_str",
|
||||||
|
"nom_disp",
|
||||||
|
"nomprenom",
|
||||||
|
"ne",
|
||||||
|
"email_default",
|
||||||
|
]
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/partitions/groups/1",
|
SCODOC_URL + "/ScoDoc/api/partitions/groups/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
|
||||||
r = requests.get(
|
assert len(r.json()) == 16
|
||||||
SCODOC_URL + "/ScoDoc/api/partitions/groups/<int:group_id>/etat/<string:etat>",
|
assert fields_OK is True
|
||||||
headers=HEADERS,
|
# r = requests.get(
|
||||||
verify=CHECK_CERTIFICATE,
|
# SCODOC_URL + "/ScoDoc/api/partitions/groups/1/etat/<string:etat>",
|
||||||
)
|
# headers=HEADERS,
|
||||||
assert r.status_code == 200
|
# verify=CHECK_CERTIFICATE,
|
||||||
|
# )
|
||||||
|
# assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# set_groups
|
# # set_groups
|
||||||
def test_set_groups():
|
# def test_set_groups():
|
||||||
r = requests.get(
|
# r = requests.get(
|
||||||
SCODOC_URL
|
# SCODOC_URL
|
||||||
+ "/ScoDoc/api/partitions/set_groups?partition_id=<int:partition_id>&groups_lists=<int:groups_lists>&"
|
# + "/partitions/set_groups/partition/<int:partition_id>/groups/<string:groups_id>"
|
||||||
"groups_to_create=<int:groups_to_create>&groups_to_delete=<int:groups_to_delete>",
|
# "/delete/<string:groups_to_delete>/create/<string:groups_to_create>",
|
||||||
headers=HEADERS,
|
# headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
# verify=CHECK_CERTIFICATE,
|
||||||
)
|
# )
|
||||||
assert r.status_code == 200
|
# assert r.status_code == 200
|
||||||
|
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