forked from ScoDoc/ScoDoc
ajout des tests pour la version 'long' de etudiant_courant + correction routes et doc sur les fichiers api
This commit is contained in:
parent
07cdd29716
commit
aba6330065
@ -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)
|
||||||
|
@ -59,7 +59,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)
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ def formation_export_by_formation_id(formation_id: int, export_ids=False):
|
|||||||
|
|
||||||
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,
|
||||||
@ -192,15 +192,15 @@ def formation_export_by_formation_id(formation_id: int, export_ids=False):
|
|||||||
@token_permission_required(Permission.APIView)
|
@token_permission_required(Permission.APIView)
|
||||||
def moduleimpls(moduleimpl_id: int):
|
def moduleimpls(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
|
||||||
"""
|
"""
|
||||||
# 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 +208,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,
|
||||||
|
@ -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
|
||||||
|
@ -23,85 +23,16 @@ 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
|
||||||
|
|
||||||
|
|
||||||
# # 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(): # XXX TODO pour Seb
|
||||||
|
|
||||||
fields = [
|
fields = [
|
||||||
"civilite",
|
|
||||||
"code_ine",
|
|
||||||
"code_nip",
|
|
||||||
"date_naissance",
|
|
||||||
"email",
|
|
||||||
"emailperso",
|
|
||||||
"etudid",
|
|
||||||
"nom",
|
|
||||||
"prenom",
|
|
||||||
"nomprenom",
|
|
||||||
"lieu_naissance",
|
|
||||||
"dept_naissance",
|
|
||||||
"nationalite",
|
|
||||||
"boursier",
|
|
||||||
"id",
|
"id",
|
||||||
"domicile",
|
"nip",
|
||||||
"villedomicile",
|
"nom",
|
||||||
"telephone",
|
"nom_usuel",
|
||||||
"fax",
|
"prenom",
|
||||||
"description",
|
"civilite",
|
||||||
"codepostaldomicile",
|
|
||||||
"paysdomicile",
|
|
||||||
"telephonemobile",
|
|
||||||
"typeadresse",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
@ -124,6 +55,55 @@ def test_etudiants_courant(): # XXX TODO pour Seb
|
|||||||
|
|
||||||
assert fields_OK is True
|
assert fields_OK is True
|
||||||
|
|
||||||
|
########## Version long################
|
||||||
|
|
||||||
|
fields_long = [
|
||||||
|
"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(
|
||||||
|
SCODOC_URL + "/ScoDoc/api/etudiants/courant/long",
|
||||||
|
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_long:
|
||||||
|
fields_OK = False
|
||||||
|
|
||||||
|
assert fields_OK is True
|
||||||
|
|
||||||
|
|
||||||
# etudiant
|
# etudiant
|
||||||
def test_etudiant(): # XXX TODO pour Seb
|
def test_etudiant(): # XXX TODO pour Seb
|
||||||
|
Loading…
Reference in New Issue
Block a user