forked from ScoDoc/ScoDoc
tests etudiant fini et formsemestre commencé
This commit is contained in:
parent
6aba3a3ccd
commit
29715a740f
@ -1,4 +1,6 @@
|
||||
#################################################### Etudiants ########################################################
|
||||
import app
|
||||
|
||||
from flask import jsonify
|
||||
|
||||
from app import models
|
||||
@ -10,6 +12,7 @@ from app.scodoc.sco_groups import get_etud_groups
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
|
||||
|
||||
|
||||
@bp.route("/etudiants", methods=["GET"])
|
||||
@token_auth.login_required
|
||||
@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
|
||||
inscriptions = models.FormSemestreInscription.query.all()
|
||||
|
||||
sems = []
|
||||
# Filtre les inscriptions contenant l'étudiant
|
||||
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:
|
||||
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
|
||||
# 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()
|
||||
|
||||
etu = None
|
||||
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()
|
||||
formsemestre = models.FormSemestre.query.filter_by(id=formsemestre_id).first()
|
||||
|
||||
if ine is not None: # Si route ine
|
||||
etu = models.Identite.query.filter_by(code_nip=ine).first()
|
||||
dept = models.Departement.query.filter_by(id=formsemestre.dept_id).first()
|
||||
|
||||
if etu is not None: # Si route nip ou ine
|
||||
return make_json_formsemestre_bulletinetud(formsemestre_id, etu.etudid)
|
||||
app.set_sco_dept(dept.acronym)
|
||||
|
||||
# return error_response(501, message="Not implemented")
|
||||
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, etudid)
|
||||
|
||||
|
||||
@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 nip is not None: # Si route nip
|
||||
# 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
|
||||
etudid = etu.etudid
|
||||
|
||||
if ine is not None: # Si route ine
|
||||
# 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
|
||||
etudid = etu.etudid
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
########################################## Formsemestres ##############################################################
|
||||
from flask import jsonify
|
||||
|
||||
import app
|
||||
from app import models
|
||||
from app.api import bp
|
||||
from app.api.errors import error_response
|
||||
from app.api.auth import token_auth, token_permission_required
|
||||
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_pvjury import formsemestre_pvjury
|
||||
from app.scodoc.sco_recapcomplet import formsemestre_recapcomplet
|
||||
@ -44,7 +46,7 @@ def formsemestre(formsemestre_id: int):
|
||||
)
|
||||
@token_auth.login_required
|
||||
@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
|
||||
|
||||
@ -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()
|
||||
|
||||
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")
|
||||
# make_json_formsemestre_bulletinetud
|
||||
|
||||
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"])
|
||||
|
@ -25,16 +25,6 @@ from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||
|
||||
# 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 = [
|
||||
"civilite",
|
||||
@ -63,6 +53,17 @@ def test_etudiants():
|
||||
"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
|
||||
@ -75,6 +76,34 @@ def test_etudiants():
|
||||
|
||||
# etudiants_courant
|
||||
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(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiants/courant",
|
||||
headers=HEADERS,
|
||||
@ -83,9 +112,51 @@ def test_etudiants_courant(): # XXX TODO pour Seb
|
||||
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
|
||||
|
||||
|
||||
# etudiant
|
||||
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(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1",
|
||||
headers=HEADERS,
|
||||
@ -94,6 +165,19 @@ def test_etudiant(): # XXX TODO pour Seb
|
||||
assert r.status_code == 200
|
||||
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(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiant/nip/1",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
@ -101,6 +185,19 @@ def test_etudiant(): # XXX TODO pour Seb
|
||||
assert r.status_code == 200
|
||||
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(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiant/ine/1",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
@ -108,9 +205,51 @@ def test_etudiant(): # XXX TODO pour Seb
|
||||
assert r.status_code == 200
|
||||
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
|
||||
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(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1/formsemestres",
|
||||
headers=HEADERS,
|
||||
@ -119,44 +258,162 @@ def test_etudiant_formsemestres(): # XXX TODO pour Seb
|
||||
assert r.status_code == 200
|
||||
assert len(r.json()) == 1
|
||||
|
||||
# r = requests.get(
|
||||
# SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/formsemestres",
|
||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
# )
|
||||
# assert r.status_code == 200
|
||||
#
|
||||
# r = requests.get(
|
||||
# SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>/formsemestres",
|
||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
# )
|
||||
# assert r.status_code == 200
|
||||
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
|
||||
|
||||
|
||||
# etudiant_bulletin_semestre
|
||||
# def test_etudiant_bulletin_semestre():
|
||||
# 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()) == 1
|
||||
######### Test code nip #########
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiant/nip/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
|
||||
|
||||
######### 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(
|
||||
# SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin",
|
||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
# )
|
||||
# assert r.status_code == 200
|
||||
#
|
||||
# r = requests.get(
|
||||
# SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin",
|
||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
# )
|
||||
# assert r.status_code == 200
|
||||
#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 #########
|
||||
|
||||
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
|
||||
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(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1/semestre/1/groups",
|
||||
headers=HEADERS,
|
||||
@ -165,14 +422,55 @@ def test_etudiant_groups():
|
||||
assert r.status_code == 200
|
||||
assert len(r.json()) == 1
|
||||
|
||||
# r = requests.get(
|
||||
# SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/semestre/<int:formsemestre_id>/groups",
|
||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
# )
|
||||
# assert r.status_code == 200
|
||||
#
|
||||
# r = requests.get(
|
||||
# SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>/semestre/<int:formsemestre_id>/groups",
|
||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
# )
|
||||
# assert r.status_code == 200
|
||||
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 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
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
# bulletins
|
||||
def test_bulletins():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formsemestre/1/bulletins",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
|
||||
# jury
|
||||
def test_jury():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formsemestre/1/jury",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
# # bulletins
|
||||
# def test_bulletins():
|
||||
# r = requests.get(
|
||||
# SCODOC_URL + "/ScoDoc/api/formsemestre/1/bulletins",
|
||||
# headers=HEADERS,
|
||||
# verify=CHECK_CERTIFICATE,
|
||||
# )
|
||||
# assert r.status_code == 200
|
||||
#
|
||||
#
|
||||
# # jury
|
||||
# def test_jury():
|
||||
# r = requests.get(
|
||||
# SCODOC_URL + "/ScoDoc/api/formsemestre/1/jury",
|
||||
# headers=HEADERS,
|
||||
# verify=CHECK_CERTIFICATE,
|
||||
# )
|
||||
# assert r.status_code == 200
|
Loading…
Reference in New Issue
Block a user