forked from ScoDoc/DocScoDoc
Utilisation du jeton pour protéger les routes API
This commit is contained in:
parent
c580d98414
commit
c7dbb9b0a9
@ -24,6 +24,10 @@
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
from functools import wraps
|
||||
|
||||
|
||||
from flask import abort
|
||||
from flask import g
|
||||
from flask_httpauth import HTTPBasicAuth, HTTPTokenAuth
|
||||
from app.auth.models import User
|
||||
@ -63,15 +67,17 @@ def get_user_roles(user):
|
||||
return user.roles
|
||||
|
||||
|
||||
# def token_permission_required(permission):
|
||||
# def decorator(f):
|
||||
# @wraps(f)
|
||||
# def decorated_function(*args, **kwargs):
|
||||
# scodoc_dept = getattr(g, "scodoc_dept", None)
|
||||
# if not current_user.has_permission(permission, scodoc_dept):
|
||||
# abort(403)
|
||||
# return f(*args, **kwargs)
|
||||
def token_permission_required(permission):
|
||||
def decorator(f):
|
||||
@wraps(f)
|
||||
def decorated_function(*args, **kwargs):
|
||||
scodoc_dept = getattr(g, "scodoc_dept", None)
|
||||
if hasattr(g, "current_user") and not g.current_user.has_permission(
|
||||
permission, scodoc_dept
|
||||
):
|
||||
abort(403)
|
||||
return f(*args, **kwargs)
|
||||
|
||||
# return login_required(decorated_function)
|
||||
return decorated_function # login_required(decorated_function)
|
||||
|
||||
# return decorator
|
||||
return decorator
|
||||
|
@ -1,23 +1,17 @@
|
||||
############################################### Departements ##########################################################
|
||||
from flask import g
|
||||
from flask import jsonify
|
||||
|
||||
from app import models
|
||||
from app.api import bp
|
||||
from app.api.auth import token_auth
|
||||
from app.api.auth import token_auth, token_permission_required
|
||||
from app.api.errors import error_response
|
||||
from app.decorators import permission_required
|
||||
from app.models import ApcReferentielCompetences
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
from app.scodoc.sco_prepajury import feuille_preparation_jury
|
||||
from app.scodoc.sco_pvjury import formsemestre_pvjury
|
||||
from app.scodoc.sco_recapcomplet import formsemestre_recapcomplet
|
||||
from app.scodoc.sco_saisie_notes import notes_add
|
||||
|
||||
|
||||
|
||||
@bp.route("/departements", methods=["GET"])
|
||||
@token_auth.login_required # Commenté le temps des tests
|
||||
# @permission_required(Permission.ScoView)
|
||||
@token_auth.login_required
|
||||
@token_permission_required(Permission.APIView)
|
||||
def departements():
|
||||
"""
|
||||
Retourne la liste des ids de départements visibles
|
||||
@ -34,7 +28,9 @@ def departements():
|
||||
|
||||
|
||||
@bp.route("/departements/<string:dept>/etudiants/liste", methods=["GET"])
|
||||
@bp.route("/departements/<string:dept>/etudiants/liste/<int:formsemestre_id>", methods=["GET"])
|
||||
@bp.route(
|
||||
"/departements/<string:dept>/etudiants/liste/<int:formsemestre_id>", methods=["GET"]
|
||||
)
|
||||
@token_auth.login_required
|
||||
# @permission_required(Permission.APIView)
|
||||
def liste_etudiants(dept: str, formsemestre_id=None):
|
||||
@ -154,7 +150,10 @@ def liste_semestres_courant(dept: str):
|
||||
return jsonify(data)
|
||||
|
||||
|
||||
@bp.route("/departements/<string:dept>/formations/<int:formation_id>/referentiel_competences", methods=["GET"])
|
||||
@bp.route(
|
||||
"/departements/<string:dept>/formations/<int:formation_id>/referentiel_competences",
|
||||
methods=["GET"],
|
||||
)
|
||||
# @permission_required(Permission.APIView)
|
||||
def referenciel_competences(dept: str, formation_id: int):
|
||||
"""
|
||||
@ -167,12 +166,16 @@ def referenciel_competences(dept: str, formation_id: int):
|
||||
|
||||
id_dept = depts[0].id
|
||||
|
||||
formations = models.Formation.query.filter_by(id=formation_id, dept_id=id_dept).all()
|
||||
formations = models.Formation.query.filter_by(
|
||||
id=formation_id, dept_id=id_dept
|
||||
).all()
|
||||
|
||||
ref_comp = formations[0].referentiel_competence_id
|
||||
|
||||
if ref_comp is None:
|
||||
return error_response(204, message="Pas de référenciel de compétences pour cette formation")
|
||||
return error_response(
|
||||
204, message="Pas de référenciel de compétences pour cette formation"
|
||||
)
|
||||
else:
|
||||
return jsonify(ref_comp)
|
||||
|
||||
@ -181,7 +184,10 @@ def referenciel_competences(dept: str, formation_id: int):
|
||||
# return jsonify(ref.to_dict())
|
||||
|
||||
|
||||
@bp.route("/departements/<string:dept>/formsemestre/<string:formsemestre_id>/programme", methods=["GET"])
|
||||
@bp.route(
|
||||
"/departements/<string:dept>/formsemestre/<string:formsemestre_id>/programme",
|
||||
methods=["GET"],
|
||||
)
|
||||
# @permission_required(Permission.APIView)
|
||||
def semestre_index(dept: str, formsemestre_id: int):
|
||||
"""
|
||||
|
@ -1,5 +1,8 @@
|
||||
################################################## Tests ##############################################################
|
||||
|
||||
|
||||
# XXX OBSOLETE ??? XXX
|
||||
|
||||
import requests
|
||||
import os
|
||||
|
||||
@ -15,6 +18,7 @@ CHECK_CERTIFICATE = bool(int(os.environ.get("CHECK_CERTIFICATE", False)))
|
||||
|
||||
HEADERS = None
|
||||
|
||||
|
||||
def get_token():
|
||||
"""
|
||||
Permet de set le token dans le header
|
||||
@ -52,7 +56,8 @@ def get_departement():
|
||||
# departements
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/departements",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE,
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
|
||||
if r.status_code == 200:
|
||||
@ -90,17 +95,40 @@ def get_formsemestre():
|
||||
# liste_semestres_courant
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/departements/" + dept_acronym + "/semestres_courants",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD),
|
||||
)
|
||||
|
||||
if r.status_code == 200:
|
||||
formsemestre = r.json()[0]
|
||||
print(r.json()[0])
|
||||
|
||||
fields = ["gestion_semestrielle", "titre", "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"]
|
||||
fields = [
|
||||
"gestion_semestrielle",
|
||||
"titre",
|
||||
"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",
|
||||
]
|
||||
|
||||
for field in formsemestre:
|
||||
if field not in fields:
|
||||
@ -114,7 +142,6 @@ def get_formsemestre():
|
||||
return error_response(409, "La requête ne peut être traitée en l’état actuel")
|
||||
|
||||
|
||||
|
||||
@bp.route("/test_etu", methods=["GET"])
|
||||
def get_etudiant():
|
||||
"""
|
||||
@ -124,14 +151,23 @@ def get_etudiant():
|
||||
# etudiants
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiants/courant",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD),
|
||||
)
|
||||
|
||||
if r.status_code == 200:
|
||||
etu = r.json()[0]
|
||||
|
||||
fields = ["civilite", "code_ine", "code_nip", "date_naissance", "email", "emailperso", "etudid", "nom",
|
||||
"prenom"]
|
||||
fields = [
|
||||
"civilite",
|
||||
"code_ine",
|
||||
"code_nip",
|
||||
"date_naissance",
|
||||
"email",
|
||||
"emailperso",
|
||||
"etudid",
|
||||
"nom",
|
||||
"prenom",
|
||||
]
|
||||
|
||||
for field in etu:
|
||||
if field not in fields:
|
||||
@ -162,12 +198,22 @@ def test_departements_liste_etudiants():
|
||||
global FORMSEMESTRE
|
||||
|
||||
# Set les fields à vérifier
|
||||
fields = ["civilite", "code_ine", "code_nip", "date_naissance", "email", "emailperso", "etudid", "nom", "prenom"]
|
||||
fields = [
|
||||
"civilite",
|
||||
"code_ine",
|
||||
"code_nip",
|
||||
"date_naissance",
|
||||
"email",
|
||||
"emailperso",
|
||||
"etudid",
|
||||
"nom",
|
||||
"prenom",
|
||||
]
|
||||
|
||||
# liste_etudiants (sans formsemestre)
|
||||
r1 = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/departements/" + DEPT["acronym"] + "/etudiants/liste",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD),
|
||||
)
|
||||
|
||||
if r1.status_code == 200: # Si la requête est "OK"
|
||||
@ -180,12 +226,14 @@ def test_departements_liste_etudiants():
|
||||
if field not in fields:
|
||||
return error_response(501, field + " field missing")
|
||||
|
||||
|
||||
# liste_etudiants (avec formsemestre)
|
||||
r2 = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/departements/" + DEPT["acronym"] + "/etudiants/liste/" +
|
||||
str(FORMSEMESTRE["formsemestre_id"]),
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/departements/"
|
||||
+ DEPT["acronym"]
|
||||
+ "/etudiants/liste/"
|
||||
+ str(FORMSEMESTRE["formsemestre_id"]),
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD),
|
||||
)
|
||||
|
||||
if r2.status_code == 200: # Si la requête est "OK"
|
||||
@ -216,9 +264,13 @@ def test_departements_referenciel_competences():
|
||||
|
||||
# referenciel_competences
|
||||
r = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api/departements/" + DEPT["acronym"] + "/formations/" +
|
||||
FORMSEMESTRE["formation_id"] + "/referentiel_competences",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/departements/"
|
||||
+ DEPT["acronym"]
|
||||
+ "/formations/"
|
||||
+ FORMSEMESTRE["formation_id"]
|
||||
+ "/referentiel_competences",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD),
|
||||
)
|
||||
|
||||
|
||||
@ -229,53 +281,42 @@ def test_departements_semestre_index():
|
||||
"""
|
||||
# semestre_index
|
||||
r5 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api/departements/" + DEPT["acronym"] + "/formsemestre/" +
|
||||
FORMSEMESTRE["formation_id"] + "/programme",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/departements/"
|
||||
+ DEPT["acronym"]
|
||||
+ "/formsemestre/"
|
||||
+ FORMSEMESTRE["formation_id"]
|
||||
+ "/programme",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD),
|
||||
)
|
||||
|
||||
|
||||
#################################################### Etudiants ########################################################
|
||||
|
||||
|
||||
def test_routes_etudiants():
|
||||
"""
|
||||
Test les routes de la partie Etudiants
|
||||
"""
|
||||
# etudiants
|
||||
r1 = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiants",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
SCODOC_URL + "/ScoDoc/api/etudiants", auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
|
||||
# etudiants_courant
|
||||
r2 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# etudiant
|
||||
r3 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# etudiant_formsemestres
|
||||
r4 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r4 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# etudiant_bulletin_semestre
|
||||
r5 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r5 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# etudiant_groups
|
||||
r6 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r6 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
|
||||
def test_routes_formation():
|
||||
@ -283,40 +324,22 @@ def test_routes_formation():
|
||||
Test les routes de la partie Formation
|
||||
"""
|
||||
# formations
|
||||
r1 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r1 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# formations_by_id
|
||||
r2 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# formation_export_by_formation_id
|
||||
r3 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# formsemestre_apo
|
||||
r4 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r4 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# moduleimpls
|
||||
r5 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r5 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# moduleimpls_sem
|
||||
r6 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r6 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
|
||||
def test_routes_formsemestres():
|
||||
@ -324,28 +347,16 @@ def test_routes_formsemestres():
|
||||
Test les routes de la partie Formsemestres
|
||||
"""
|
||||
# formsemestre
|
||||
r1 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r1 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# etudiant_bulletin
|
||||
r2 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# bulletins
|
||||
r3 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# jury
|
||||
r4 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r4 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
|
||||
def test_routes_partitions():
|
||||
@ -353,22 +364,13 @@ def test_routes_partitions():
|
||||
Test les routes de la partie Partitions
|
||||
"""
|
||||
# partition
|
||||
r1 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r1 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# etud_in_group
|
||||
r2 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# set_groups
|
||||
r3 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
|
||||
def test_routes_evaluations():
|
||||
@ -376,22 +378,13 @@ def test_routes_evaluations():
|
||||
Test les routes de la partie Evaluations
|
||||
"""
|
||||
# evaluations
|
||||
r1 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r1 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# evaluation_notes
|
||||
r2 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# evaluation_set_notes
|
||||
r3 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
|
||||
def test_routes_jury():
|
||||
@ -399,28 +392,16 @@ def test_routes_jury():
|
||||
Test les routes de la partie Jury
|
||||
"""
|
||||
# jury_preparation
|
||||
r1 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r1 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# jury_decisions
|
||||
r2 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# set_decision_jury
|
||||
r3 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# annule_decision_jury
|
||||
r4 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r4 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
|
||||
def test_routes_absences():
|
||||
@ -428,40 +409,22 @@ def test_routes_absences():
|
||||
Test les routes de la partie Absences
|
||||
"""
|
||||
# absences
|
||||
r1 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r1 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# absences_justify
|
||||
r2 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# abs_signale
|
||||
r3 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# abs_annule
|
||||
r4 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r4 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# abs_annule_justif
|
||||
r5 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r5 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# abs_groupe_etat
|
||||
r6 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r6 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
|
||||
def test_routes_logos():
|
||||
@ -469,25 +432,13 @@ def test_routes_logos():
|
||||
Test les routes de la partie Logos
|
||||
"""
|
||||
# liste_logos
|
||||
r1 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r1 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# recup_logo_global
|
||||
r2 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# logo_dept
|
||||
r3 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
||||
# recup_logo_dept_global
|
||||
r4 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api",
|
||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
r4 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||
|
@ -73,7 +73,9 @@ token = r.json()["token"]
|
||||
HEADERS = {"Authorization": f"Bearer {token}"}
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/list_depts", headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL + "/ScoDoc/api/list_depts",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
if r.status_code != 200:
|
||||
raise ScoError("erreur de connexion: vérifier adresse et identifiants")
|
||||
|
@ -16,25 +16,22 @@ Utilisation :
|
||||
import os
|
||||
import requests
|
||||
|
||||
SCODOC_USER = "test"
|
||||
SCODOC_PASSWORD = "test"
|
||||
SCODOC_URL = "http://192.168.1.12:5000"
|
||||
|
||||
SCODOC_USER = "api_tester"
|
||||
SCODOC_PASSWORD = "api_tester"
|
||||
SCODOC_URL = "http://deb11.viennet.net:5000"
|
||||
CHECK_CERTIFICATE = bool(int(os.environ.get("CHECK_CERTIFICATE", False)))
|
||||
|
||||
HEADERS = None
|
||||
|
||||
def get_token():
|
||||
"""
|
||||
Permet de set le token dans le header
|
||||
"""
|
||||
global HEADERS
|
||||
global SCODOC_USER
|
||||
global SCODOC_PASSWORD
|
||||
|
||||
r0 = requests.post(
|
||||
SCODOC_URL + "/ScoDoc/api/tokens", auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||
)
|
||||
token = r0.json()["token"]
|
||||
HEADERS = {"Authorization": f"Bearer {token}"}
|
||||
return {"Authorization": f"Bearer {token}"}
|
||||
|
||||
get_token()
|
||||
|
||||
HEADERS = get_token()
|
||||
|
@ -18,26 +18,29 @@ Utilisation :
|
||||
"""
|
||||
|
||||
import requests
|
||||
from tests.api.setup_test_api import SCODOC_URL, HEADERS, CHECK_CERTIFICATE
|
||||
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||
|
||||
|
||||
# absences
|
||||
def test_absences():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/etudid/<int:etudid>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/nip/<int:nip>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/ine/<int:ine>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
@ -46,49 +49,61 @@ def test_absences():
|
||||
def test_absences_justify():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/etudid/<int:etudid>/abs_just_only",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/nip/<int:nip>/abs_just_only",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/ine/<int:ine>/abs_just_only",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
|
||||
# abs_signale
|
||||
def test_abs_signale():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/abs_signale?etudid=<int:etudid>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/absences/abs_signale?etudid=<int:etudid>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
||||
"&description=<string:description>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/abs_signale?nip=<int:nip>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/absences/abs_signale?nip=<int:nip>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
||||
"&description=<string:description>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
||||
"&description=<string:description>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
||||
"&description=<string:description>&moduleimpl_id=<int:moduleimpl_id>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
@ -96,20 +111,26 @@ def test_abs_signale():
|
||||
# abs_annule
|
||||
def test_abs_annule():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/abs_annule?etudid=<int:etudid>&jour=<string:jour>&matin=<string:matin>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/absences/abs_annule?etudid=<int:etudid>&jour=<string:jour>&matin=<string:matin>",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/abs_annule?nip=<int:nip>&jour=<string:jour>&matin=<string:matin>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/absences/abs_annule?nip=<int:nip>&jour=<string:jour>&matin=<string:matin>",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/abs_annule?ine=<int:ine>&jour=<string:jour>&matin=<string:matin>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/absences/abs_annule?ine=<int:ine>&jour=<string:jour>&matin=<string:matin>",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
@ -117,27 +138,36 @@ def test_abs_annule():
|
||||
# abs_annule_justif
|
||||
def test_abs_annule_justif():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?etudid=<int:etudid>&jour=<string:jour>&matin=<string:matin>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/absences/abs_annule_justif?etudid=<int:etudid>&jour=<string:jour>&matin=<string:matin>",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?nip=<int:nip>&jour=<string:jour>&matin=<string:matin>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/absences/abs_annule_justif?nip=<int:nip>&jour=<string:jour>&matin=<string:matin>",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?ine=<int:ine>&jour=<string:jour>&matin=<string:matin>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/absences/abs_annule_justif?ine=<int:ine>&jour=<string:jour>&matin=<string:matin>",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
|
||||
# abs_groupe_etat
|
||||
def test_abs_groupe_etat():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/absences/abs_group_etat/?group_id=<int:group_id>&date_debut=date_debut&date_fin=date_fin",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/absences/abs_group_etat/?group_id=<int:group_id>&date_debut=date_debut&date_fin=date_fin",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
@ -18,14 +18,16 @@ Utilisation :
|
||||
"""
|
||||
|
||||
import requests
|
||||
from tests.api.setup_test_api import SCODOC_URL, HEADERS, CHECK_CERTIFICATE
|
||||
|
||||
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||
|
||||
|
||||
# departements
|
||||
def test_departements():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/departements",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert len(r.json()) == 1
|
||||
@ -35,14 +37,16 @@ def test_departements():
|
||||
def test_liste_etudiants():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/departements/TAPI/etudiants/liste",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert len(r.json()) == 16
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/departements/TAPI/etudiants/liste/1",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert len(r.json()) == 16
|
||||
@ -52,7 +56,8 @@ def test_liste_etudiants():
|
||||
def test_semestres_courant():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/departements/TAPI/semestres_courants",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert len(r.json()) == 1
|
||||
@ -61,8 +66,10 @@ def test_semestres_courant():
|
||||
# referenciel_competences
|
||||
def test_referenciel_competences():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/departements/TAPI/formations/1/referentiel_competences",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/departements/TAPI/formations/1/referentiel_competences",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200 or 204
|
||||
|
||||
@ -74,21 +81,3 @@ def test_referenciel_competences():
|
||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
# )
|
||||
# assert r.status_code == 200
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -19,14 +19,15 @@ Utilisation :
|
||||
from random import randint
|
||||
|
||||
import requests
|
||||
from tests.api.setup_test_api import SCODOC_URL, HEADERS, CHECK_CERTIFICATE
|
||||
|
||||
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
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert len(r.json()) == 16
|
||||
@ -34,8 +35,18 @@ def test_etudiants():
|
||||
# Choisis aléatoirement un étudiant dans la liste des étudiants
|
||||
etu = r.json()[randint(0, len(r.json())) - 1]
|
||||
|
||||
fields = ["civilite", "code_ine", "code_nip", "date_naissance", "email", "emailperso", "etudid", "nom",
|
||||
"prenom", "nomprenom"]
|
||||
fields = [
|
||||
"civilite",
|
||||
"code_ine",
|
||||
"code_nip",
|
||||
"date_naissance",
|
||||
"email",
|
||||
"emailperso",
|
||||
"etudid",
|
||||
"nom",
|
||||
"prenom",
|
||||
"nomprenom",
|
||||
]
|
||||
|
||||
fields_OK = True
|
||||
|
||||
@ -51,7 +62,8 @@ def test_etudiants():
|
||||
def test_etudiants_courant():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiants/courant",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert len(r.json()) == 0
|
||||
@ -61,7 +73,8 @@ def test_etudiants_courant():
|
||||
def test_etudiant():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert len(r.json()) == 10
|
||||
@ -82,7 +95,8 @@ def test_etudiant():
|
||||
def test_etudiant_formsemestres():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1/formsemestres",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert len(r.json()) == 1
|
||||
@ -127,12 +141,12 @@ def test_etudiant_formsemestres():
|
||||
def test_etudiant_groups():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1/semestre/1/groups",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
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
|
||||
|
@ -18,41 +18,51 @@ Utilisation :
|
||||
"""
|
||||
|
||||
import requests
|
||||
from tests.api.setup_test_api import SCODOC_URL, HEADERS, CHECK_CERTIFICATE
|
||||
|
||||
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||
|
||||
# evaluations
|
||||
def test_evaluations():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/evaluations/<int:moduleimpl_id>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
|
||||
# evaluation_notes
|
||||
def test_evaluation_notes():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/evaluations/eval_notes/<int:evaluation_id>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
|
||||
# evaluation_set_notes
|
||||
def test_evaluation_set_notes():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=<int:eval_id>&etudid=<int:etudid>¬e=<float:note>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/evaluations/eval_set_notes?eval_id=<int:eval_id>&etudid=<int:etudid>¬e=<float:note>",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=<int:eval_id>&nip=<int:nip>¬e=<float:note>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/evaluations/eval_set_notes?eval_id=<int:eval_id>&nip=<int:nip>¬e=<float:note>",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=<int:eval_id>&ine=<int:ine>¬e=<float:note>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/evaluations/eval_set_notes?eval_id=<int:eval_id>&ine=<int:ine>¬e=<float:note>",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
@ -18,38 +18,45 @@ Utilisation :
|
||||
"""
|
||||
|
||||
import requests
|
||||
from tests.api.setup_test_api import SCODOC_URL, HEADERS, CHECK_CERTIFICATE
|
||||
|
||||
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||
|
||||
# formations
|
||||
def test_formations():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formations",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
|
||||
# formations_by_id
|
||||
def test_formations_by_id():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formations/<int:formation_id>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
|
||||
# formation_export_by_formation_id
|
||||
def test_formation_export_by_formation_id():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formations/formation_export/<int:formation_id>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
|
||||
# formsemestre_apo
|
||||
def test_formsemestre_apo():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formations/apo/<string:etape_apo>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
@ -58,7 +65,8 @@ def test_formsemestre_apo():
|
||||
def test_moduleimpls():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formations/moduleimpl/<int:moduleimpl_id>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
@ -66,7 +74,9 @@ def test_moduleimpls():
|
||||
# moduleimpls_sem
|
||||
def test_moduleimpls_sem():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formations/moduleimpl/<int:moduleimpl_id>/formsemestre/<int:formsemestre_id>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/formations/moduleimpl/<int:moduleimpl_id>/formsemestre/<int:formsemestre_id>",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
@ -18,42 +18,52 @@ Utilisation :
|
||||
"""
|
||||
|
||||
import requests
|
||||
from tests.api.setup_test_api import SCODOC_URL, HEADERS, CHECK_CERTIFICATE
|
||||
|
||||
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||
|
||||
# formsemestre
|
||||
def test_formsemestre():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formations/formsemestre/<int:formsemestre_id>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
|
||||
# etudiant_bulletin
|
||||
def test_etudiant_bulletin():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/etudid/<int:etudid>/bulletin",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/etudid/<int:etudid>/bulletin",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/nip/<int:nip>/bulletin",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/nip/<int:nip>/bulletin",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/ine/<int:ine>/bulletin",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/ine/<int:ine>/bulletin",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
|
||||
# bulletins
|
||||
def test_bulletins():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/bulletins",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
@ -62,6 +72,7 @@ def test_bulletins():
|
||||
def test_jury():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/jury",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
@ -18,45 +18,57 @@ Utilisation :
|
||||
"""
|
||||
|
||||
import requests
|
||||
from tests.api.setup_test_api import SCODOC_URL, HEADERS, CHECK_CERTIFICATE
|
||||
|
||||
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||
|
||||
# jury_preparation
|
||||
def test_jury_preparation():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/jury/formsemestre/<int:formsemestre_id>/preparation_jury",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/jury/formsemestre/<int:formsemestre_id>/preparation_jury",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
|
||||
# jury_decisions
|
||||
def test_jury_decisions():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/jury/formsemestre/<int:formsemestre_id>/decisions_jury",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/jury/formsemestre/<int:formsemestre_id>/decisions_jury",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
|
||||
# set_decision_jury
|
||||
def test_set_decision_jury():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/jury/set_decision/etudid?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/jury/set_decision/etudid?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
|
||||
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/jury/set_decision/nip?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/jury/set_decision/nip?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
|
||||
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/jury/set_decision/ine?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/jury/set_decision/ine?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
|
||||
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
@ -64,20 +76,25 @@ def test_set_decision_jury():
|
||||
# annule_decision_jury
|
||||
def test_annule_decision_jury():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/jury/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/annule_decision",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/jury/nip/<int:nip>/formsemestre/<int:formsemestre_id>/annule_decision",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/jury/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/annule_decision",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/jury/ine/<int:ine>/formsemestre/<int:formsemestre_id>/annule_decision",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/jury/nip/<int:nip>/formsemestre/<int:formsemestre_id>/annule_decision",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
r = requests.get(
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/jury/ine/<int:ine>/formsemestre/<int:formsemestre_id>/annule_decision",
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
@ -9,7 +9,7 @@ utilisation:
|
||||
pytest tests/api/test_api_logos.py
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||
|
||||
from scodoc import app
|
||||
from tests.unit.config_test_logos import (
|
||||
|
@ -18,27 +18,31 @@ Utilisation :
|
||||
"""
|
||||
|
||||
import requests
|
||||
from tests.api.setup_test_api import SCODOC_URL, HEADERS, CHECK_CERTIFICATE
|
||||
|
||||
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
||||
|
||||
# partition
|
||||
def test_partition():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/partitions/<int:formsemestre_id>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
|
||||
# etud_in_group
|
||||
def test_etud_in_group():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/partitions/groups/<int:group_id>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/partitions/groups/<int:group_id>/etat/<string:etat>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
@ -46,8 +50,10 @@ def test_etud_in_group():
|
||||
# set_groups
|
||||
def test_set_groups():
|
||||
r = requests.get(
|
||||
SCODOC_URL + "/ScoDoc/api/partitions/set_groups?partition_id=<int:partition_id>&groups_lists=<int:groups_lists>&"
|
||||
SCODOC_URL
|
||||
+ "/ScoDoc/api/partitions/set_groups?partition_id=<int:partition_id>&groups_lists=<int:groups_lists>&"
|
||||
"groups_to_create=<int:groups_to_create>&groups_to_delete=<int:groups_to_delete>",
|
||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||
headers=HEADERS,
|
||||
verify=CHECK_CERTIFICATE,
|
||||
)
|
||||
assert r.status_code == 200
|
Loading…
Reference in New Issue
Block a user