forked from ScoDoc/ScoDoc
tests etudiant fini et formsemestre commencé
This commit is contained in:
parent
6aba3a3ccd
commit
29715a740f
@ -1,4 +1,6 @@
|
|||||||
#################################################### Etudiants ########################################################
|
#################################################### Etudiants ########################################################
|
||||||
|
import app
|
||||||
|
|
||||||
from flask import jsonify
|
from flask import jsonify
|
||||||
|
|
||||||
from app import models
|
from app import models
|
||||||
@ -10,6 +12,7 @@ from app.scodoc.sco_groups import get_etud_groups
|
|||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/etudiants", methods=["GET"])
|
@bp.route("/etudiants", methods=["GET"])
|
||||||
@token_auth.login_required
|
@token_auth.login_required
|
||||||
@token_permission_required(Permission.APIView)
|
@token_permission_required(Permission.APIView)
|
||||||
@ -204,29 +207,27 @@ def etudiant_formsemestres(etudid: int = None, nip: int = None, ine: int = None)
|
|||||||
...
|
...
|
||||||
]
|
]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Récupération de toutes les inscriptions
|
# Récupération de toutes les inscriptions
|
||||||
inscriptions = models.FormSemestreInscription.query.all()
|
inscriptions = models.FormSemestreInscription.query.all()
|
||||||
|
|
||||||
sems = []
|
sems = []
|
||||||
# Filtre les inscriptions contenant l'étudiant
|
# Filtre les inscriptions contenant l'étudiant
|
||||||
for sem in inscriptions:
|
for sem in inscriptions:
|
||||||
if etudid is not None: # Si route etudid
|
if etudid is None:
|
||||||
|
if nip is None: # si ine
|
||||||
|
# Récupération de l'étudiant
|
||||||
|
etu = models.Identite.query.filter_by(code_ine=str(ine)).first()
|
||||||
|
if sem.etudid == etu.etudid:
|
||||||
|
sems.append(sem)
|
||||||
|
else: # si nip
|
||||||
|
# Récupération de l'étudiant
|
||||||
|
etu = models.Identite.query.filter_by(code_nip=str(nip)).first()
|
||||||
|
if sem.etudid == etu.etudid:
|
||||||
|
sems.append(sem)
|
||||||
|
else: # si etudid
|
||||||
if sem.etudid == etudid:
|
if sem.etudid == etudid:
|
||||||
sems.append(sem)
|
sems.append(sem)
|
||||||
|
|
||||||
if nip is not None: # Si route nip
|
|
||||||
# Récupération de l'étudiant
|
|
||||||
etu = models.Identite.query.filter_by(code_nip=nip).first()
|
|
||||||
if sem.etudid == etu.etudid:
|
|
||||||
sems.append(sem)
|
|
||||||
|
|
||||||
if ine is not None: # Si route ine
|
|
||||||
# Récupération de l'étudiant
|
|
||||||
etu = models.Identite.query.filter_by(code_ine=ine).firt()
|
|
||||||
if sem.etudid == etu.etudid:
|
|
||||||
sems.append(sem)
|
|
||||||
|
|
||||||
# Mise en forme des données
|
# Mise en forme des données
|
||||||
# data_inscriptions = [d.to_dict() for d in sems]
|
# data_inscriptions = [d.to_dict() for d in sems]
|
||||||
|
|
||||||
@ -261,20 +262,21 @@ def etudiant_bulletin_semestre(formsemestre_id, etudid: int = None, nip: int = N
|
|||||||
"""
|
"""
|
||||||
# Fonction utilisée : app.scodoc.sco_bulletins_json.make_json_formsemestre_bulletinetud()
|
# Fonction utilisée : app.scodoc.sco_bulletins_json.make_json_formsemestre_bulletinetud()
|
||||||
|
|
||||||
etu = None
|
formsemestre = models.FormSemestre.query.filter_by(id=formsemestre_id).first()
|
||||||
if etudid is not None: # Si route etudid
|
|
||||||
return make_json_formsemestre_bulletinetud(formsemestre_id, etudid)
|
|
||||||
else:
|
|
||||||
if nip is not None: # Si route nip
|
|
||||||
etu = models.Identite.query.filter_by(code_nip=nip).first()
|
|
||||||
|
|
||||||
if ine is not None: # Si route ine
|
dept = models.Departement.query.filter_by(id=formsemestre.dept_id).first()
|
||||||
etu = models.Identite.query.filter_by(code_nip=ine).first()
|
|
||||||
|
|
||||||
if etu is not None: # Si route nip ou ine
|
app.set_sco_dept(dept.acronym)
|
||||||
|
|
||||||
|
if etudid is None:
|
||||||
|
if nip is None: # si ine
|
||||||
|
etu = models.Identite.query.filter_by(code_nip=str(ine)).first()
|
||||||
|
return make_json_formsemestre_bulletinetud(formsemestre_id, etu.etudid)
|
||||||
|
else: # si nip
|
||||||
|
etu = models.Identite.query.filter_by(code_nip=str(nip)).first()
|
||||||
return make_json_formsemestre_bulletinetud(formsemestre_id, etu.etudid)
|
return make_json_formsemestre_bulletinetud(formsemestre_id, etu.etudid)
|
||||||
|
|
||||||
# return error_response(501, message="Not implemented")
|
return make_json_formsemestre_bulletinetud(formsemestre_id, etudid)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/etudiant/etudid/<int:etudid>/semestre/<int:formsemestre_id>/groups", methods=["GET"])
|
@bp.route("/etudiant/etudid/<int:etudid>/semestre/<int:formsemestre_id>/groups", methods=["GET"])
|
||||||
@ -322,13 +324,13 @@ def etudiant_groups(formsemestre_id: int, etudid: int = None, nip: int = None, i
|
|||||||
if etudid is None:
|
if etudid is None:
|
||||||
if nip is not None: # Si route nip
|
if nip is not None: # Si route nip
|
||||||
# Récupération de l'étudiant
|
# Récupération de l'étudiant
|
||||||
etu = models.Identite.query.filter_by(code_nip=nip).first()
|
etu = models.Identite.query.filter_by(code_nip=str(nip)).first()
|
||||||
# Récupération de sont etudid
|
# Récupération de sont etudid
|
||||||
etudid = etu.etudid
|
etudid = etu.etudid
|
||||||
|
|
||||||
if ine is not None: # Si route ine
|
if ine is not None: # Si route ine
|
||||||
# Récupération de l'étudiant
|
# Récupération de l'étudiant
|
||||||
etu = models.Identite.query.filter_by(code_ine=ine).first()
|
etu = models.Identite.query.filter_by(code_ine=str(ine)).first()
|
||||||
# Récupération de sont etudid
|
# Récupération de sont etudid
|
||||||
etudid = etu.etudid
|
etudid = etu.etudid
|
||||||
|
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
########################################## Formsemestres ##############################################################
|
########################################## Formsemestres ##############################################################
|
||||||
from flask import jsonify
|
from flask import jsonify
|
||||||
|
|
||||||
|
import app
|
||||||
from app import models
|
from app import models
|
||||||
from app.api import bp
|
from app.api import bp
|
||||||
from app.api.errors import error_response
|
from app.api.errors import error_response
|
||||||
from app.api.auth import token_auth, token_permission_required
|
from app.api.auth import token_auth, token_permission_required
|
||||||
from app.scodoc.sco_bulletins import formsemestre_bulletinetud_dict
|
from app.scodoc.sco_bulletins import formsemestre_bulletinetud_dict
|
||||||
|
from app.scodoc.sco_bulletins_json import make_json_formsemestre_bulletinetud
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
from app.scodoc.sco_pvjury import formsemestre_pvjury
|
from app.scodoc.sco_pvjury import formsemestre_pvjury
|
||||||
from app.scodoc.sco_recapcomplet import formsemestre_recapcomplet
|
from app.scodoc.sco_recapcomplet import formsemestre_recapcomplet
|
||||||
@ -44,7 +46,7 @@ def formsemestre(formsemestre_id: int):
|
|||||||
)
|
)
|
||||||
@token_auth.login_required
|
@token_auth.login_required
|
||||||
@token_permission_required(Permission.APIView)
|
@token_permission_required(Permission.APIView)
|
||||||
def etudiant_bulletin(formsemestre_id, dept, etudid, format="json", *args, size):
|
def etudiant_bulletin(formsemestre_id, dept, format="json", etudid: int = None, nip: int = None, ine: int = None, ):#*args, size
|
||||||
"""
|
"""
|
||||||
Retourne le bulletin de note d'un étudiant
|
Retourne le bulletin de note d'un étudiant
|
||||||
|
|
||||||
@ -55,17 +57,42 @@ def etudiant_bulletin(formsemestre_id, dept, etudid, format="json", *args, size)
|
|||||||
"""
|
"""
|
||||||
# Fonction utilisée : app.scodoc.sco_bulletins.formsemestre_billetinetud_dict()
|
# Fonction utilisée : app.scodoc.sco_bulletins.formsemestre_billetinetud_dict()
|
||||||
|
|
||||||
data = []
|
# make_json_formsemestre_bulletinetud
|
||||||
if args[0] == "short":
|
|
||||||
data = formsemestre_bulletinetud_dict(formsemestre_id, etudid, version=args[0])
|
|
||||||
elif args[0] == "selectevals":
|
|
||||||
data = formsemestre_bulletinetud_dict(formsemestre_id, etudid, version=args[0])
|
|
||||||
elif args[0] == "long":
|
|
||||||
data = formsemestre_bulletinetud_dict(formsemestre_id, etudid)
|
|
||||||
else:
|
|
||||||
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
|
||||||
|
|
||||||
return jsonify(data)
|
app.set_sco_dept(dept)
|
||||||
|
|
||||||
|
data = []
|
||||||
|
|
||||||
|
if etudid is None:
|
||||||
|
if nip is None: # si ine
|
||||||
|
etu = models.Identite.query.filter_by(code_ine=str(ine)).first()
|
||||||
|
# data = formsemestre_bulletinetud_dict(formsemestre_id, etu.id)
|
||||||
|
data = make_json_formsemestre_bulletinetud(formsemestre_id, etu.id)
|
||||||
|
return data
|
||||||
|
else: # si nip
|
||||||
|
etu = models.Identite.query.filter_by(code_nip=str(nip)).first()
|
||||||
|
# data = formsemestre_bulletinetud_dict(formsemestre_id, etu.id)
|
||||||
|
data = make_json_formsemestre_bulletinetud(formsemestre_id, etu.id)
|
||||||
|
return data
|
||||||
|
else: # si etudid
|
||||||
|
# data = formsemestre_bulletinetud_dict(formsemestre_id, etudid)
|
||||||
|
data = make_json_formsemestre_bulletinetud(formsemestre_id, etudid)
|
||||||
|
# return jsonify(data)
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# if args[0] == "short":
|
||||||
|
# data = formsemestre_bulletinetud_dict(formsemestre_id, etudid, version=args[0])
|
||||||
|
# elif args[0] == "selectevals":
|
||||||
|
# data = formsemestre_bulletinetud_dict(formsemestre_id, etudid, version=args[0])
|
||||||
|
# elif args[0] == "long":
|
||||||
|
# data = formsemestre_bulletinetud_dict(formsemestre_id, etudid)
|
||||||
|
# else:
|
||||||
|
# return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
||||||
|
#
|
||||||
|
# return jsonify(data)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/formsemestre/<int:formsemestre_id>/bulletins", methods=["GET"])
|
@bp.route("/formsemestre/<int:formsemestre_id>/bulletins", methods=["GET"])
|
||||||
|
@ -25,16 +25,6 @@ from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
|||||||
|
|
||||||
# etudiants
|
# etudiants
|
||||||
def test_etudiants():
|
def test_etudiants():
|
||||||
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 = [
|
fields = [
|
||||||
"civilite",
|
"civilite",
|
||||||
@ -63,6 +53,17 @@ def test_etudiants():
|
|||||||
"typeadresse",
|
"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
|
fields_OK = True
|
||||||
|
|
||||||
# Vérifie si tous les champs sont bien présents
|
# Vérifie si tous les champs sont bien présents
|
||||||
@ -75,6 +76,34 @@ def test_etudiants():
|
|||||||
|
|
||||||
# etudiants_courant
|
# etudiants_courant
|
||||||
def test_etudiants_courant(): # XXX TODO pour Seb
|
def test_etudiants_courant(): # XXX TODO pour Seb
|
||||||
|
|
||||||
|
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(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/etudiants/courant",
|
SCODOC_URL + "/ScoDoc/api/etudiants/courant",
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
@ -83,9 +112,51 @@ def test_etudiants_courant(): # XXX TODO pour Seb
|
|||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 16
|
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
|
||||||
|
|
||||||
|
|
||||||
# etudiant
|
# etudiant
|
||||||
def test_etudiant(): # XXX TODO pour Seb
|
def test_etudiant(): # XXX TODO pour Seb
|
||||||
|
|
||||||
|
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",
|
||||||
|
]
|
||||||
|
|
||||||
|
######### Test etudid #########
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1",
|
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1",
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
@ -94,6 +165,19 @@ def test_etudiant(): # XXX TODO pour Seb
|
|||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 24
|
assert len(r.json()) == 24
|
||||||
|
|
||||||
|
etu = r.json()
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
######### Test code nip #########
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/etudiant/nip/1",
|
SCODOC_URL + "/ScoDoc/api/etudiant/nip/1",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||||
@ -101,6 +185,19 @@ def test_etudiant(): # XXX TODO pour Seb
|
|||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 24
|
assert len(r.json()) == 24
|
||||||
|
|
||||||
|
etu = r.json()
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
######### Test code ine #########
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/etudiant/ine/1",
|
SCODOC_URL + "/ScoDoc/api/etudiant/ine/1",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||||
@ -108,9 +205,51 @@ def test_etudiant(): # XXX TODO pour Seb
|
|||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 24
|
assert len(r.json()) == 24
|
||||||
|
|
||||||
|
etu = r.json()
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
# etudiant_formsemestres
|
# etudiant_formsemestres
|
||||||
def test_etudiant_formsemestres(): # XXX TODO pour Seb
|
def test_etudiant_formsemestres(): # XXX TODO pour Seb
|
||||||
|
|
||||||
|
fields = [
|
||||||
|
"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",
|
||||||
|
"titre",
|
||||||
|
"block_moyennes",
|
||||||
|
"scodoc7_id",
|
||||||
|
"date_debut",
|
||||||
|
"gestion_semestrielle",
|
||||||
|
"bul_bgcolor",
|
||||||
|
"formsemestre_id",
|
||||||
|
"titre_num",
|
||||||
|
"date_debut_iso",
|
||||||
|
"date_fin_iso",
|
||||||
|
"responsables",
|
||||||
|
]
|
||||||
|
|
||||||
|
######### Test etudid #########
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1/formsemestres",
|
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1/formsemestres",
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
@ -119,44 +258,162 @@ def test_etudiant_formsemestres(): # XXX TODO pour Seb
|
|||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 1
|
assert len(r.json()) == 1
|
||||||
|
|
||||||
# r = requests.get(
|
formsemestre = r.json()[0]
|
||||||
# SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/formsemestres",
|
|
||||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
fields_OK = True
|
||||||
# )
|
|
||||||
# assert r.status_code == 200
|
# Vérifie si tous les champs sont bien présents
|
||||||
#
|
for field in formsemestre:
|
||||||
# r = requests.get(
|
if field not in fields:
|
||||||
# SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>/formsemestres",
|
fields_OK = False
|
||||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
|
||||||
# )
|
assert fields_OK is True
|
||||||
# assert r.status_code == 200
|
|
||||||
|
|
||||||
|
|
||||||
# etudiant_bulletin_semestre
|
######### Test code nip #########
|
||||||
# def test_etudiant_bulletin_semestre():
|
|
||||||
# r = requests.get(
|
r = requests.get(
|
||||||
# SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1/formsemestre/1/bulletin",
|
SCODOC_URL + "/ScoDoc/api/etudiant/nip/1/formsemestres",
|
||||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||||
# )
|
)
|
||||||
# assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
# assert len(r.json()) == 1
|
assert len(r.json()) == 1
|
||||||
|
|
||||||
|
formsemestre = r.json()[0]
|
||||||
|
|
||||||
|
fields_OK = True
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
######### Test code ine #########
|
||||||
|
|
||||||
|
r = requests.get(
|
||||||
|
SCODOC_URL + "/ScoDoc/api/etudiant/ine/1/formsemestres",
|
||||||
|
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||||
|
)
|
||||||
|
assert r.status_code == 200
|
||||||
|
assert len(r.json()) == 1
|
||||||
|
|
||||||
|
formsemestre = r.json()[0]
|
||||||
|
|
||||||
|
fields_OK = True
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
# r = requests.get(
|
#etudiant_bulletin_semestre
|
||||||
# SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin",
|
def test_etudiant_bulletin_semestre():
|
||||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
|
||||||
# )
|
fields = [
|
||||||
# assert r.status_code == 200
|
"etudid",
|
||||||
#
|
"formsemestre_id",
|
||||||
# r = requests.get(
|
"date",
|
||||||
# SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin",
|
"publie",
|
||||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
"etapes",
|
||||||
# )
|
"etudiant",
|
||||||
# assert r.status_code == 200
|
"note",
|
||||||
|
"rang",
|
||||||
|
"rang_group",
|
||||||
|
"note_max",
|
||||||
|
"bonus_sport_culture",
|
||||||
|
"ue",
|
||||||
|
"ue_capitalisee",
|
||||||
|
"absences",
|
||||||
|
"appreciation",
|
||||||
|
]
|
||||||
|
|
||||||
|
######### Test etudid #########
|
||||||
|
|
||||||
|
r = requests.get(
|
||||||
|
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1/formsemestre/1/bulletin",
|
||||||
|
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||||
|
)
|
||||||
|
assert r.status_code == 200
|
||||||
|
assert len(r.json()) == 15
|
||||||
|
|
||||||
|
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 #########
|
||||||
|
|
||||||
|
r = requests.get(
|
||||||
|
SCODOC_URL + "/ScoDoc/api/etudiant/nip/1/formsemestre/1/bulletin",
|
||||||
|
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||||
|
)
|
||||||
|
assert r.status_code == 200
|
||||||
|
assert len(r.json()) == 15
|
||||||
|
|
||||||
|
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 #########
|
||||||
|
|
||||||
|
r = requests.get(
|
||||||
|
SCODOC_URL + "/ScoDoc/api/etudiant/ine/1/formsemestre/1/bulletin",
|
||||||
|
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||||
|
)
|
||||||
|
assert r.status_code == 200
|
||||||
|
assert len(r.json()) == 15
|
||||||
|
|
||||||
|
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():
|
||||||
|
|
||||||
|
fields = [
|
||||||
|
"partition_id",
|
||||||
|
"id",
|
||||||
|
"formsemestre_id",
|
||||||
|
"partition_name",
|
||||||
|
"numero",
|
||||||
|
"bul_show_rank",
|
||||||
|
"show_in_lists",
|
||||||
|
"group_id",
|
||||||
|
"group_name",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
######### Test etudid #########
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1/semestre/1/groups",
|
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1/semestre/1/groups",
|
||||||
headers=HEADERS,
|
headers=HEADERS,
|
||||||
@ -165,14 +422,55 @@ def test_etudiant_groups():
|
|||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 1
|
assert len(r.json()) == 1
|
||||||
|
|
||||||
# r = requests.get(
|
groups = r.json()[0]
|
||||||
# SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/semestre/<int:formsemestre_id>/groups",
|
|
||||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
fields_OK = True
|
||||||
# )
|
|
||||||
# assert r.status_code == 200
|
# Vérifie si tous les champs sont bien présents
|
||||||
#
|
for field in groups:
|
||||||
# r = requests.get(
|
if field not in fields:
|
||||||
# SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>/semestre/<int:formsemestre_id>/groups",
|
fields_OK = False
|
||||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
|
||||||
# )
|
assert fields_OK is True
|
||||||
# assert r.status_code == 200
|
|
||||||
|
|
||||||
|
|
||||||
|
######### Test code nip #########
|
||||||
|
|
||||||
|
r = requests.get(
|
||||||
|
SCODOC_URL + "/ScoDoc/api/etudiant/nip/1/semestre/1/groups",
|
||||||
|
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||||
|
)
|
||||||
|
assert r.status_code == 200
|
||||||
|
assert len(r.json()) == 1
|
||||||
|
|
||||||
|
groups = r.json()[0]
|
||||||
|
|
||||||
|
fields_OK = True
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
######### Test code ine #########
|
||||||
|
|
||||||
|
r = requests.get(
|
||||||
|
SCODOC_URL + "/ScoDoc/api/etudiant/ine/1/semestre/1/groups",
|
||||||
|
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||||
|
)
|
||||||
|
assert r.status_code == 200
|
||||||
|
assert len(r.json()) == 1
|
||||||
|
|
||||||
|
groups = r.json()[0]
|
||||||
|
|
||||||
|
fields_OK = True
|
||||||
|
|
||||||
|
# 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
|
||||||
|
@ -30,6 +30,45 @@ def test_formsemestre():
|
|||||||
)
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
formsemestre = r.json()
|
||||||
|
|
||||||
|
fields = [
|
||||||
|
"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",
|
||||||
|
"titre",
|
||||||
|
"block_moyennes",
|
||||||
|
"scodoc7_id",
|
||||||
|
"date_debut",
|
||||||
|
"gestion_semestrielle",
|
||||||
|
"bul_bgcolor",
|
||||||
|
"formsemestre_id",
|
||||||
|
"titre_num",
|
||||||
|
"date_debut_iso",
|
||||||
|
"date_fin_iso",
|
||||||
|
"responsables",
|
||||||
|
]
|
||||||
|
|
||||||
|
fields_OK = True
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
# etudiant_bulletin
|
# etudiant_bulletin
|
||||||
def test_etudiant_bulletin(): #XXX TODO pour Seb
|
def test_etudiant_bulletin(): #XXX TODO pour Seb
|
||||||
@ -58,21 +97,21 @@ def test_etudiant_bulletin(): #XXX TODO pour Seb
|
|||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# bulletins
|
# # bulletins
|
||||||
def test_bulletins():
|
# def test_bulletins():
|
||||||
r = requests.get(
|
# r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formsemestre/1/bulletins",
|
# SCODOC_URL + "/ScoDoc/api/formsemestre/1/bulletins",
|
||||||
headers=HEADERS,
|
# headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
# verify=CHECK_CERTIFICATE,
|
||||||
)
|
# )
|
||||||
assert r.status_code == 200
|
# assert r.status_code == 200
|
||||||
|
#
|
||||||
|
#
|
||||||
# jury
|
# # jury
|
||||||
def test_jury():
|
# def test_jury():
|
||||||
r = requests.get(
|
# r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formsemestre/1/jury",
|
# SCODOC_URL + "/ScoDoc/api/formsemestre/1/jury",
|
||||||
headers=HEADERS,
|
# headers=HEADERS,
|
||||||
verify=CHECK_CERTIFICATE,
|
# verify=CHECK_CERTIFICATE,
|
||||||
)
|
# )
|
||||||
assert r.status_code == 200
|
# assert r.status_code == 200
|
Loading…
Reference in New Issue
Block a user