forked from ScoDoc/ScoDoc
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
|
# 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.
|
# 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 import g
|
||||||
from flask_httpauth import HTTPBasicAuth, HTTPTokenAuth
|
from flask_httpauth import HTTPBasicAuth, HTTPTokenAuth
|
||||||
from app.auth.models import User
|
from app.auth.models import User
|
||||||
@ -63,15 +67,17 @@ def get_user_roles(user):
|
|||||||
return user.roles
|
return user.roles
|
||||||
|
|
||||||
|
|
||||||
# def token_permission_required(permission):
|
def token_permission_required(permission):
|
||||||
# def decorator(f):
|
def decorator(f):
|
||||||
# @wraps(f)
|
@wraps(f)
|
||||||
# def decorated_function(*args, **kwargs):
|
def decorated_function(*args, **kwargs):
|
||||||
# scodoc_dept = getattr(g, "scodoc_dept", None)
|
scodoc_dept = getattr(g, "scodoc_dept", None)
|
||||||
# if not current_user.has_permission(permission, scodoc_dept):
|
if hasattr(g, "current_user") and not g.current_user.has_permission(
|
||||||
# abort(403)
|
permission, scodoc_dept
|
||||||
# return f(*args, **kwargs)
|
):
|
||||||
|
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 ##########################################################
|
############################################### Departements ##########################################################
|
||||||
|
from flask import g
|
||||||
from flask import jsonify
|
from flask import jsonify
|
||||||
|
|
||||||
from app import models
|
from app import models
|
||||||
from app.api import bp
|
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.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_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"])
|
@bp.route("/departements", methods=["GET"])
|
||||||
@token_auth.login_required # Commenté le temps des tests
|
@token_auth.login_required
|
||||||
# @permission_required(Permission.ScoView)
|
@token_permission_required(Permission.APIView)
|
||||||
def departements():
|
def departements():
|
||||||
"""
|
"""
|
||||||
Retourne la liste des ids de départements visibles
|
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", 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
|
@token_auth.login_required
|
||||||
# @permission_required(Permission.APIView)
|
# @permission_required(Permission.APIView)
|
||||||
def liste_etudiants(dept: str, formsemestre_id=None):
|
def liste_etudiants(dept: str, formsemestre_id=None):
|
||||||
@ -154,7 +150,10 @@ def liste_semestres_courant(dept: str):
|
|||||||
return jsonify(data)
|
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)
|
# @permission_required(Permission.APIView)
|
||||||
def referenciel_competences(dept: str, formation_id: int):
|
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
|
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
|
ref_comp = formations[0].referentiel_competence_id
|
||||||
|
|
||||||
if ref_comp is None:
|
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:
|
else:
|
||||||
return jsonify(ref_comp)
|
return jsonify(ref_comp)
|
||||||
|
|
||||||
@ -181,11 +184,14 @@ def referenciel_competences(dept: str, formation_id: int):
|
|||||||
# return jsonify(ref.to_dict())
|
# 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)
|
# @permission_required(Permission.APIView)
|
||||||
def semestre_index(dept: str, formsemestre_id: int):
|
def semestre_index(dept: str, formsemestre_id: int):
|
||||||
"""
|
"""
|
||||||
Retourne la liste des Ues, ressources et SAE d'un semestre
|
Retourne la liste des Ues, ressources et SAE d'un semestre
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return error_response(501, message="not implemented")
|
return error_response(501, message="not implemented")
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
################################################## Tests ##############################################################
|
################################################## Tests ##############################################################
|
||||||
|
|
||||||
|
|
||||||
|
# XXX OBSOLETE ??? XXX
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -15,6 +18,7 @@ CHECK_CERTIFICATE = bool(int(os.environ.get("CHECK_CERTIFICATE", False)))
|
|||||||
|
|
||||||
HEADERS = None
|
HEADERS = None
|
||||||
|
|
||||||
|
|
||||||
def get_token():
|
def get_token():
|
||||||
"""
|
"""
|
||||||
Permet de set le token dans le header
|
Permet de set le token dans le header
|
||||||
@ -25,7 +29,7 @@ def get_token():
|
|||||||
|
|
||||||
r0 = requests.post(
|
r0 = requests.post(
|
||||||
SCODOC_URL + "/ScoDoc/api/tokens", auth=(SCODOC_USER, SCODOC_PASSWORD)
|
SCODOC_URL + "/ScoDoc/api/tokens", auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||||
)
|
)
|
||||||
token = r0.json()["token"]
|
token = r0.json()["token"]
|
||||||
HEADERS = {"Authorization": f"Bearer {token}"}
|
HEADERS = {"Authorization": f"Bearer {token}"}
|
||||||
|
|
||||||
@ -52,7 +56,8 @@ def get_departement():
|
|||||||
# departements
|
# departements
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/departements",
|
SCODOC_URL + "/ScoDoc/api/departements",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE,
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
|
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
@ -90,17 +95,40 @@ def get_formsemestre():
|
|||||||
# liste_semestres_courant
|
# liste_semestres_courant
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/departements/" + dept_acronym + "/semestres_courants",
|
SCODOC_URL + "/ScoDoc/api/departements/" + dept_acronym + "/semestres_courants",
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
auth=(SCODOC_USER, SCODOC_PASSWORD),
|
||||||
)
|
)
|
||||||
|
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
formsemestre = r.json()[0]
|
formsemestre = r.json()[0]
|
||||||
print(r.json()[0])
|
print(r.json()[0])
|
||||||
|
|
||||||
fields = ["gestion_semestrielle", "titre", "scodoc7_id", "date_debut", "bul_bgcolor", "date_fin",
|
fields = [
|
||||||
"resp_can_edit", "dept_id", "etat", "resp_can_change_ens", "id", "modalite", "ens_can_edit_eval",
|
"gestion_semestrielle",
|
||||||
"formation_id", "gestion_compensation", "elt_sem_apo", "semestre_id", "bul_hide_xml", "elt_annee_apo",
|
"titre",
|
||||||
"block_moyennes", "formsemestre_id", "titre_num", "date_debut_iso", "date_fin_iso", "responsables"]
|
"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:
|
for field in formsemestre:
|
||||||
if field not in fields:
|
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")
|
return error_response(409, "La requête ne peut être traitée en l’état actuel")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/test_etu", methods=["GET"])
|
@bp.route("/test_etu", methods=["GET"])
|
||||||
def get_etudiant():
|
def get_etudiant():
|
||||||
"""
|
"""
|
||||||
@ -124,14 +151,23 @@ def get_etudiant():
|
|||||||
# etudiants
|
# etudiants
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/etudiants/courant",
|
SCODOC_URL + "/ScoDoc/api/etudiants/courant",
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
auth=(SCODOC_USER, SCODOC_PASSWORD),
|
||||||
)
|
)
|
||||||
|
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
etu = r.json()[0]
|
etu = r.json()[0]
|
||||||
|
|
||||||
fields = ["civilite", "code_ine", "code_nip", "date_naissance", "email", "emailperso", "etudid", "nom",
|
fields = [
|
||||||
"prenom"]
|
"civilite",
|
||||||
|
"code_ine",
|
||||||
|
"code_nip",
|
||||||
|
"date_naissance",
|
||||||
|
"email",
|
||||||
|
"emailperso",
|
||||||
|
"etudid",
|
||||||
|
"nom",
|
||||||
|
"prenom",
|
||||||
|
]
|
||||||
|
|
||||||
for field in etu:
|
for field in etu:
|
||||||
if field not in fields:
|
if field not in fields:
|
||||||
@ -162,15 +198,25 @@ def test_departements_liste_etudiants():
|
|||||||
global FORMSEMESTRE
|
global FORMSEMESTRE
|
||||||
|
|
||||||
# Set les fields à vérifier
|
# 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)
|
# liste_etudiants (sans formsemestre)
|
||||||
r1 = requests.get(
|
r1 = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/departements/" + DEPT["acronym"] + "/etudiants/liste",
|
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"
|
if r1.status_code == 200: # Si la requête est "OK"
|
||||||
# On récupère la liste des étudiants
|
# On récupère la liste des étudiants
|
||||||
etudiants = r1.json()
|
etudiants = r1.json()
|
||||||
|
|
||||||
@ -180,15 +226,17 @@ def test_departements_liste_etudiants():
|
|||||||
if field not in fields:
|
if field not in fields:
|
||||||
return error_response(501, field + " field missing")
|
return error_response(501, field + " field missing")
|
||||||
|
|
||||||
|
|
||||||
# liste_etudiants (avec formsemestre)
|
# liste_etudiants (avec formsemestre)
|
||||||
r2 = requests.get(
|
r2 = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/departements/" + DEPT["acronym"] + "/etudiants/liste/" +
|
SCODOC_URL
|
||||||
str(FORMSEMESTRE["formsemestre_id"]),
|
+ "/ScoDoc/api/departements/"
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
+ DEPT["acronym"]
|
||||||
|
+ "/etudiants/liste/"
|
||||||
|
+ str(FORMSEMESTRE["formsemestre_id"]),
|
||||||
|
auth=(SCODOC_USER, SCODOC_PASSWORD),
|
||||||
)
|
)
|
||||||
|
|
||||||
if r2.status_code == 200: # Si la requête est "OK"
|
if r2.status_code == 200: # Si la requête est "OK"
|
||||||
# On récupère la liste des étudiants
|
# On récupère la liste des étudiants
|
||||||
etudiants = r2.json()
|
etudiants = r2.json()
|
||||||
|
|
||||||
@ -216,10 +264,14 @@ def test_departements_referenciel_competences():
|
|||||||
|
|
||||||
# referenciel_competences
|
# referenciel_competences
|
||||||
r = requests.post(
|
r = requests.post(
|
||||||
SCODOC_URL + "/ScoDoc/api/departements/" + DEPT["acronym"] + "/formations/" +
|
SCODOC_URL
|
||||||
FORMSEMESTRE["formation_id"] + "/referentiel_competences",
|
+ "/ScoDoc/api/departements/"
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
+ DEPT["acronym"]
|
||||||
)
|
+ "/formations/"
|
||||||
|
+ FORMSEMESTRE["formation_id"]
|
||||||
|
+ "/referentiel_competences",
|
||||||
|
auth=(SCODOC_USER, SCODOC_PASSWORD),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/test_liste_semestre_index")
|
@bp.route("/test_liste_semestre_index")
|
||||||
@ -229,53 +281,42 @@ def test_departements_semestre_index():
|
|||||||
"""
|
"""
|
||||||
# semestre_index
|
# semestre_index
|
||||||
r5 = requests.post(
|
r5 = requests.post(
|
||||||
SCODOC_URL + "/ScoDoc/api/departements/" + DEPT["acronym"] + "/formsemestre/" +
|
SCODOC_URL
|
||||||
FORMSEMESTRE["formation_id"] + "/programme",
|
+ "/ScoDoc/api/departements/"
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
+ DEPT["acronym"]
|
||||||
)
|
+ "/formsemestre/"
|
||||||
|
+ FORMSEMESTRE["formation_id"]
|
||||||
|
+ "/programme",
|
||||||
|
auth=(SCODOC_USER, SCODOC_PASSWORD),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
#################################################### Etudiants ########################################################
|
#################################################### Etudiants ########################################################
|
||||||
|
|
||||||
|
|
||||||
def test_routes_etudiants():
|
def test_routes_etudiants():
|
||||||
"""
|
"""
|
||||||
Test les routes de la partie Etudiants
|
Test les routes de la partie Etudiants
|
||||||
"""
|
"""
|
||||||
# etudiants
|
# etudiants
|
||||||
r1 = requests.get(
|
r1 = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/etudiants",
|
SCODOC_URL + "/ScoDoc/api/etudiants", auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
# etudiants_courant
|
# etudiants_courant
|
||||||
r2 = requests.post(
|
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# etudiant
|
# etudiant
|
||||||
r3 = requests.post(
|
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# etudiant_formsemestres
|
# etudiant_formsemestres
|
||||||
r4 = requests.post(
|
r4 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# etudiant_bulletin_semestre
|
# etudiant_bulletin_semestre
|
||||||
r5 = requests.post(
|
r5 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# etudiant_groups
|
# etudiant_groups
|
||||||
r6 = requests.post(
|
r6 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_routes_formation():
|
def test_routes_formation():
|
||||||
@ -283,40 +324,22 @@ def test_routes_formation():
|
|||||||
Test les routes de la partie Formation
|
Test les routes de la partie Formation
|
||||||
"""
|
"""
|
||||||
# formations
|
# formations
|
||||||
r1 = requests.post(
|
r1 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# formations_by_id
|
# formations_by_id
|
||||||
r2 = requests.post(
|
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# formation_export_by_formation_id
|
# formation_export_by_formation_id
|
||||||
r3 = requests.post(
|
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# formsemestre_apo
|
# formsemestre_apo
|
||||||
r4 = requests.post(
|
r4 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# moduleimpls
|
# moduleimpls
|
||||||
r5 = requests.post(
|
r5 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# moduleimpls_sem
|
# moduleimpls_sem
|
||||||
r6 = requests.post(
|
r6 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_routes_formsemestres():
|
def test_routes_formsemestres():
|
||||||
@ -324,28 +347,16 @@ def test_routes_formsemestres():
|
|||||||
Test les routes de la partie Formsemestres
|
Test les routes de la partie Formsemestres
|
||||||
"""
|
"""
|
||||||
# formsemestre
|
# formsemestre
|
||||||
r1 = requests.post(
|
r1 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# etudiant_bulletin
|
# etudiant_bulletin
|
||||||
r2 = requests.post(
|
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# bulletins
|
# bulletins
|
||||||
r3 = requests.post(
|
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# jury
|
# jury
|
||||||
r4 = requests.post(
|
r4 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_routes_partitions():
|
def test_routes_partitions():
|
||||||
@ -353,22 +364,13 @@ def test_routes_partitions():
|
|||||||
Test les routes de la partie Partitions
|
Test les routes de la partie Partitions
|
||||||
"""
|
"""
|
||||||
# partition
|
# partition
|
||||||
r1 = requests.post(
|
r1 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# etud_in_group
|
# etud_in_group
|
||||||
r2 = requests.post(
|
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# set_groups
|
# set_groups
|
||||||
r3 = requests.post(
|
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_routes_evaluations():
|
def test_routes_evaluations():
|
||||||
@ -376,22 +378,13 @@ def test_routes_evaluations():
|
|||||||
Test les routes de la partie Evaluations
|
Test les routes de la partie Evaluations
|
||||||
"""
|
"""
|
||||||
# evaluations
|
# evaluations
|
||||||
r1 = requests.post(
|
r1 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# evaluation_notes
|
# evaluation_notes
|
||||||
r2 = requests.post(
|
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# evaluation_set_notes
|
# evaluation_set_notes
|
||||||
r3 = requests.post(
|
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_routes_jury():
|
def test_routes_jury():
|
||||||
@ -399,28 +392,16 @@ def test_routes_jury():
|
|||||||
Test les routes de la partie Jury
|
Test les routes de la partie Jury
|
||||||
"""
|
"""
|
||||||
# jury_preparation
|
# jury_preparation
|
||||||
r1 = requests.post(
|
r1 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# jury_decisions
|
# jury_decisions
|
||||||
r2 = requests.post(
|
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# set_decision_jury
|
# set_decision_jury
|
||||||
r3 = requests.post(
|
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# annule_decision_jury
|
# annule_decision_jury
|
||||||
r4 = requests.post(
|
r4 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_routes_absences():
|
def test_routes_absences():
|
||||||
@ -428,40 +409,22 @@ def test_routes_absences():
|
|||||||
Test les routes de la partie Absences
|
Test les routes de la partie Absences
|
||||||
"""
|
"""
|
||||||
# absences
|
# absences
|
||||||
r1 = requests.post(
|
r1 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# absences_justify
|
# absences_justify
|
||||||
r2 = requests.post(
|
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# abs_signale
|
# abs_signale
|
||||||
r3 = requests.post(
|
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# abs_annule
|
# abs_annule
|
||||||
r4 = requests.post(
|
r4 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# abs_annule_justif
|
# abs_annule_justif
|
||||||
r5 = requests.post(
|
r5 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# abs_groupe_etat
|
# abs_groupe_etat
|
||||||
r6 = requests.post(
|
r6 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_routes_logos():
|
def test_routes_logos():
|
||||||
@ -469,25 +432,13 @@ def test_routes_logos():
|
|||||||
Test les routes de la partie Logos
|
Test les routes de la partie Logos
|
||||||
"""
|
"""
|
||||||
# liste_logos
|
# liste_logos
|
||||||
r1 = requests.post(
|
r1 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# recup_logo_global
|
# recup_logo_global
|
||||||
r2 = requests.post(
|
r2 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# logo_dept
|
# logo_dept
|
||||||
r3 = requests.post(
|
r3 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
|
||||||
# recup_logo_dept_global
|
# recup_logo_dept_global
|
||||||
r4 = requests.post(
|
r4 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD))
|
||||||
SCODOC_URL + "/ScoDoc/api",
|
|
||||||
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
||||||
)
|
|
||||||
|
@ -73,7 +73,9 @@ token = r.json()["token"]
|
|||||||
HEADERS = {"Authorization": f"Bearer {token}"}
|
HEADERS = {"Authorization": f"Bearer {token}"}
|
||||||
|
|
||||||
r = requests.get(
|
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:
|
if r.status_code != 200:
|
||||||
raise ScoError("erreur de connexion: vérifier adresse et identifiants")
|
raise ScoError("erreur de connexion: vérifier adresse et identifiants")
|
||||||
|
@ -16,25 +16,22 @@ Utilisation :
|
|||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
SCODOC_USER = "test"
|
|
||||||
SCODOC_PASSWORD = "test"
|
SCODOC_USER = "api_tester"
|
||||||
SCODOC_URL = "http://192.168.1.12:5000"
|
SCODOC_PASSWORD = "api_tester"
|
||||||
|
SCODOC_URL = "http://deb11.viennet.net:5000"
|
||||||
CHECK_CERTIFICATE = bool(int(os.environ.get("CHECK_CERTIFICATE", False)))
|
CHECK_CERTIFICATE = bool(int(os.environ.get("CHECK_CERTIFICATE", False)))
|
||||||
|
|
||||||
HEADERS = None
|
|
||||||
|
|
||||||
def get_token():
|
def get_token():
|
||||||
"""
|
"""
|
||||||
Permet de set le token dans le header
|
Permet de set le token dans le header
|
||||||
"""
|
"""
|
||||||
global HEADERS
|
|
||||||
global SCODOC_USER
|
|
||||||
global SCODOC_PASSWORD
|
|
||||||
|
|
||||||
r0 = requests.post(
|
r0 = requests.post(
|
||||||
SCODOC_URL + "/ScoDoc/api/tokens", auth=(SCODOC_USER, SCODOC_PASSWORD)
|
SCODOC_URL + "/ScoDoc/api/tokens", auth=(SCODOC_USER, SCODOC_PASSWORD)
|
||||||
)
|
)
|
||||||
token = r0.json()["token"]
|
token = r0.json()["token"]
|
||||||
HEADERS = {"Authorization": f"Bearer {token}"}
|
return {"Authorization": f"Bearer {token}"}
|
||||||
|
|
||||||
get_token()
|
|
||||||
|
HEADERS = get_token()
|
||||||
|
@ -18,126 +18,156 @@ Utilisation :
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import requests
|
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
|
# absences
|
||||||
def test_absences():
|
def test_absences():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/etudid/<int:etudid>",
|
SCODOC_URL + "/ScoDoc/api/absences/etudid/<int:etudid>",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
)
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/nip/<int:nip>",
|
SCODOC_URL + "/ScoDoc/api/absences/nip/<int:nip>",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
)
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/ine/<int:ine>",
|
SCODOC_URL + "/ScoDoc/api/absences/ine/<int:ine>",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
)
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# absences_justify
|
# absences_justify
|
||||||
def test_absences_justify():
|
def test_absences_justify():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/etudid/<int:etudid>/abs_just_only",
|
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
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/nip/<int:nip>/abs_just_only",
|
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
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/ine/<int:ine>/abs_just_only",
|
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
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# abs_signale
|
# abs_signale
|
||||||
def test_abs_signale():
|
def test_abs_signale():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/abs_signale?etudid=<int:etudid>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
SCODOC_URL
|
||||||
"&description=<string:description>",
|
+ "/ScoDoc/api/absences/abs_signale?etudid=<int:etudid>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
"&description=<string:description>",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/abs_signale?nip=<int:nip>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
SCODOC_URL
|
||||||
"&description=<string:description>",
|
+ "/ScoDoc/api/absences/abs_signale?nip=<int:nip>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
"&description=<string:description>",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
SCODOC_URL
|
||||||
"&description=<string:description>",
|
+ "/ScoDoc/api/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
"&description=<string:description>",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
SCODOC_URL
|
||||||
"&description=<string:description>&moduleimpl_id=<int:moduleimpl_id>",
|
+ "/ScoDoc/api/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
"&description=<string:description>&moduleimpl_id=<int:moduleimpl_id>",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# abs_annule
|
# abs_annule
|
||||||
def test_abs_annule():
|
def test_abs_annule():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/abs_annule?etudid=<int:etudid>&jour=<string:jour>&matin=<string:matin>",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/ScoDoc/api/absences/abs_annule?etudid=<int:etudid>&jour=<string:jour>&matin=<string:matin>",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/abs_annule?nip=<int:nip>&jour=<string:jour>&matin=<string:matin>",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/ScoDoc/api/absences/abs_annule?nip=<int:nip>&jour=<string:jour>&matin=<string:matin>",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/abs_annule?ine=<int:ine>&jour=<string:jour>&matin=<string:matin>",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/ScoDoc/api/absences/abs_annule?ine=<int:ine>&jour=<string:jour>&matin=<string:matin>",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# abs_annule_justif
|
# abs_annule_justif
|
||||||
def test_abs_annule_justif():
|
def test_abs_annule_justif():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?etudid=<int:etudid>&jour=<string:jour>&matin=<string:matin>",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/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
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?nip=<int:nip>&jour=<string:jour>&matin=<string:matin>",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/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
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?ine=<int:ine>&jour=<string:jour>&matin=<string:matin>",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/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
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# abs_groupe_etat
|
# abs_groupe_etat
|
||||||
def test_abs_groupe_etat():
|
def test_abs_groupe_etat():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/absences/abs_group_etat/?group_id=<int:group_id>&date_debut=date_debut&date_fin=date_fin",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/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
|
assert r.status_code == 200
|
||||||
|
@ -18,14 +18,16 @@ Utilisation :
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import requests
|
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
|
# departements
|
||||||
def test_departements():
|
def test_departements():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/departements",
|
SCODOC_URL + "/ScoDoc/api/departements",
|
||||||
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
|
||||||
@ -34,16 +36,18 @@ def test_departements():
|
|||||||
# liste_etudiants
|
# liste_etudiants
|
||||||
def test_liste_etudiants():
|
def test_liste_etudiants():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/departements/TAPI/etudiants/liste",
|
SCODOC_URL + "/ScoDoc/api/departements/TAPI/etudiants/liste",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
)
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 16
|
assert len(r.json()) == 16
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/departements/TAPI/etudiants/liste/1",
|
SCODOC_URL + "/ScoDoc/api/departements/TAPI/etudiants/liste/1",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
)
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 16
|
assert len(r.json()) == 16
|
||||||
|
|
||||||
@ -51,9 +55,10 @@ def test_liste_etudiants():
|
|||||||
# liste_semestres_courant
|
# liste_semestres_courant
|
||||||
def test_semestres_courant():
|
def test_semestres_courant():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/departements/TAPI/semestres_courants",
|
SCODOC_URL + "/ScoDoc/api/departements/TAPI/semestres_courants",
|
||||||
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
|
||||||
|
|
||||||
@ -61,9 +66,11 @@ def test_semestres_courant():
|
|||||||
# referenciel_competences
|
# referenciel_competences
|
||||||
def test_referenciel_competences():
|
def test_referenciel_competences():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/departements/TAPI/formations/1/referentiel_competences",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/ScoDoc/api/departements/TAPI/formations/1/referentiel_competences",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200 or 204
|
assert r.status_code == 200 or 204
|
||||||
|
|
||||||
|
|
||||||
@ -74,21 +81,3 @@ def test_referenciel_competences():
|
|||||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||||
# )
|
# )
|
||||||
# assert r.status_code == 200
|
# assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,23 +19,34 @@ Utilisation :
|
|||||||
from random import randint
|
from random import randint
|
||||||
|
|
||||||
import requests
|
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
|
# etudiants
|
||||||
def test_etudiants():
|
def test_etudiants():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/etudiants",
|
SCODOC_URL + "/ScoDoc/api/etudiants",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
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
|
# Choisis aléatoirement un étudiant dans la liste des étudiants
|
||||||
etu = r.json()[randint(0, len(r.json()))-1]
|
etu = r.json()[randint(0, len(r.json())) - 1]
|
||||||
|
|
||||||
fields = ["civilite", "code_ine", "code_nip", "date_naissance", "email", "emailperso", "etudid", "nom",
|
fields = [
|
||||||
"prenom", "nomprenom"]
|
"civilite",
|
||||||
|
"code_ine",
|
||||||
|
"code_nip",
|
||||||
|
"date_naissance",
|
||||||
|
"email",
|
||||||
|
"emailperso",
|
||||||
|
"etudid",
|
||||||
|
"nom",
|
||||||
|
"prenom",
|
||||||
|
"nomprenom",
|
||||||
|
]
|
||||||
|
|
||||||
fields_OK = True
|
fields_OK = True
|
||||||
|
|
||||||
@ -51,7 +62,8 @@ def test_etudiants():
|
|||||||
def test_etudiants_courant():
|
def test_etudiants_courant():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/etudiants/courant",
|
SCODOC_URL + "/ScoDoc/api/etudiants/courant",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 0
|
assert len(r.json()) == 0
|
||||||
@ -61,7 +73,8 @@ def test_etudiants_courant():
|
|||||||
def test_etudiant():
|
def test_etudiant():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1",
|
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json()) == 10
|
assert len(r.json()) == 10
|
||||||
@ -82,7 +95,8 @@ def test_etudiant():
|
|||||||
def test_etudiant_formsemestres():
|
def test_etudiant_formsemestres():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1/formsemestres",
|
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/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
|
||||||
@ -110,29 +124,29 @@ def test_etudiant_formsemestres():
|
|||||||
# assert len(r.json()) == 1
|
# assert len(r.json()) == 1
|
||||||
|
|
||||||
|
|
||||||
# r = requests.get(
|
# r = requests.get(
|
||||||
# SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin",
|
# SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin",
|
||||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||||
# )
|
# )
|
||||||
# assert r.status_code == 200
|
# assert r.status_code == 200
|
||||||
#
|
#
|
||||||
# r = requests.get(
|
# r = requests.get(
|
||||||
# SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin",
|
# SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin",
|
||||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||||
# )
|
# )
|
||||||
# assert r.status_code == 200
|
# assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# etudiant_groups
|
# etudiant_groups
|
||||||
def test_etudiant_groups():
|
def test_etudiant_groups():
|
||||||
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, 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
|
||||||
|
|
||||||
|
|
||||||
# r = requests.get(
|
# r = requests.get(
|
||||||
# SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/semestre/<int:formsemestre_id>/groups",
|
# SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/semestre/<int:formsemestre_id>/groups",
|
||||||
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
# headers=HEADERS, verify=CHECK_CERTIFICATE
|
||||||
|
@ -18,41 +18,51 @@ Utilisation :
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import requests
|
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
|
# evaluations
|
||||||
def test_evaluations():
|
def test_evaluations():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/evaluations/<int:moduleimpl_id>",
|
SCODOC_URL + "/ScoDoc/api/evaluations/<int:moduleimpl_id>",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
)
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# evaluation_notes
|
# evaluation_notes
|
||||||
def test_evaluation_notes():
|
def test_evaluation_notes():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/evaluations/eval_notes/<int:evaluation_id>",
|
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
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# evaluation_set_notes
|
# evaluation_set_notes
|
||||||
def test_evaluation_set_notes():
|
def test_evaluation_set_notes():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=<int:eval_id>&etudid=<int:etudid>¬e=<float:note>",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/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
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=<int:eval_id>&nip=<int:nip>¬e=<float:note>",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/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
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=<int:eval_id>&ine=<int:ine>¬e=<float:note>",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/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
|
assert r.status_code == 200
|
||||||
|
@ -18,55 +18,65 @@ Utilisation :
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import requests
|
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
|
# formations
|
||||||
def test_formations():
|
def test_formations():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formations",
|
SCODOC_URL + "/ScoDoc/api/formations",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
)
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# formations_by_id
|
# formations_by_id
|
||||||
def test_formations_by_id():
|
def test_formations_by_id():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formations/<int:formation_id>",
|
SCODOC_URL + "/ScoDoc/api/formations/<int:formation_id>",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
)
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# formation_export_by_formation_id
|
# formation_export_by_formation_id
|
||||||
def test_formation_export_by_formation_id():
|
def test_formation_export_by_formation_id():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formations/formation_export/<int:formation_id>",
|
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
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# formsemestre_apo
|
# formsemestre_apo
|
||||||
def test_formsemestre_apo():
|
def test_formsemestre_apo():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formations/apo/<string:etape_apo>",
|
SCODOC_URL + "/ScoDoc/api/formations/apo/<string:etape_apo>",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
)
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# moduleimpls
|
# moduleimpls
|
||||||
def test_moduleimpls():
|
def test_moduleimpls():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formations/moduleimpl/<int:moduleimpl_id>",
|
SCODOC_URL + "/ScoDoc/api/formations/moduleimpl/<int:moduleimpl_id>",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
)
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# moduleimpls_sem
|
# moduleimpls_sem
|
||||||
def test_moduleimpls_sem():
|
def test_moduleimpls_sem():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formations/moduleimpl/<int:moduleimpl_id>/formsemestre/<int:formsemestre_id>",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/ScoDoc/api/formations/moduleimpl/<int:moduleimpl_id>/formsemestre/<int:formsemestre_id>",
|
||||||
)
|
headers=HEADERS,
|
||||||
assert r.status_code == 200
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
|
assert r.status_code == 200
|
||||||
|
@ -18,50 +18,61 @@ Utilisation :
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import requests
|
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
|
# formsemestre
|
||||||
def test_formsemestre():
|
def test_formsemestre():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formations/formsemestre/<int:formsemestre_id>",
|
SCODOC_URL + "/ScoDoc/api/formations/formsemestre/<int:formsemestre_id>",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
)
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# etudiant_bulletin
|
# etudiant_bulletin
|
||||||
def test_etudiant_bulletin():
|
def test_etudiant_bulletin():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/etudid/<int:etudid>/bulletin",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/etudid/<int:etudid>/bulletin",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/nip/<int:nip>/bulletin",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/nip/<int:nip>/bulletin",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/ine/<int:ine>/bulletin",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/ine/<int:ine>/bulletin",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
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/<int:formsemestre_id>/bulletins",
|
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/bulletins",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
)
|
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/<int:formsemestre_id>/jury",
|
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/jury",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
)
|
verify=CHECK_CERTIFICATE,
|
||||||
assert r.status_code == 200
|
)
|
||||||
|
assert r.status_code == 200
|
||||||
|
@ -18,66 +18,83 @@ Utilisation :
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import requests
|
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
|
# jury_preparation
|
||||||
def test_jury_preparation():
|
def test_jury_preparation():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/jury/formsemestre/<int:formsemestre_id>/preparation_jury",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/ScoDoc/api/jury/formsemestre/<int:formsemestre_id>/preparation_jury",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# jury_decisions
|
# jury_decisions
|
||||||
def test_jury_decisions():
|
def test_jury_decisions():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/jury/formsemestre/<int:formsemestre_id>/decisions_jury",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/ScoDoc/api/jury/formsemestre/<int:formsemestre_id>/decisions_jury",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# set_decision_jury
|
# set_decision_jury
|
||||||
def test_set_decision_jury():
|
def test_set_decision_jury():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/jury/set_decision/etudid?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
|
SCODOC_URL
|
||||||
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
|
+ "/ScoDoc/api/jury/set_decision/etudid?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/jury/set_decision/nip?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
|
SCODOC_URL
|
||||||
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
|
+ "/ScoDoc/api/jury/set_decision/nip?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/jury/set_decision/ine?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
|
SCODOC_URL
|
||||||
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
|
+ "/ScoDoc/api/jury/set_decision/ine?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
|
||||||
)
|
headers=HEADERS,
|
||||||
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# annule_decision_jury
|
# annule_decision_jury
|
||||||
def test_annule_decision_jury():
|
def test_annule_decision_jury():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/jury/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/annule_decision",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/ScoDoc/api/jury/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/annule_decision",
|
||||||
)
|
headers=HEADERS,
|
||||||
assert r.status_code == 200
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
|
|
||||||
r = requests.get(
|
|
||||||
SCODOC_URL + "/ScoDoc/api/jury/nip/<int:nip>/formsemestre/<int:formsemestre_id>/annule_decision",
|
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
|
||||||
)
|
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/jury/ine/<int:ine>/formsemestre/<int:formsemestre_id>/annule_decision",
|
SCODOC_URL
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
+ "/ScoDoc/api/jury/nip/<int:nip>/formsemestre/<int:formsemestre_id>/annule_decision",
|
||||||
)
|
headers=HEADERS,
|
||||||
assert r.status_code == 200
|
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
|
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 scodoc import app
|
||||||
from tests.unit.config_test_logos import (
|
from tests.unit.config_test_logos import (
|
||||||
|
@ -18,36 +18,42 @@ Utilisation :
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import requests
|
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
|
# partition
|
||||||
def test_partition():
|
def test_partition():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/partitions/<int:formsemestre_id>",
|
SCODOC_URL + "/ScoDoc/api/partitions/<int:formsemestre_id>",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
)
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# etud_in_group
|
# etud_in_group
|
||||||
def test_etud_in_group():
|
def test_etud_in_group():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/partitions/groups/<int:group_id>",
|
SCODOC_URL + "/ScoDoc/api/partitions/groups/<int:group_id>",
|
||||||
headers=HEADERS, verify=CHECK_CERTIFICATE
|
headers=HEADERS,
|
||||||
)
|
verify=CHECK_CERTIFICATE,
|
||||||
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/api/partitions/groups/<int:group_id>/etat/<string:etat>",
|
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
|
assert r.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# set_groups
|
# set_groups
|
||||||
def test_set_groups():
|
def test_set_groups():
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
SCODOC_URL + "/ScoDoc/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>",
|
"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
|
)
|
||||||
|
assert r.status_code == 200
|
||||||
|
Loading…
Reference in New Issue
Block a user