diff --git a/app/api/auth.py b/app/api/auth.py index 331cd388d..20dd7ded8 100644 --- a/app/api/auth.py +++ b/app/api/auth.py @@ -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 diff --git a/app/api/departements.py b/app/api/departements.py index 43137cd9f..ee7a8899b 100644 --- a/app/api/departements.py +++ b/app/api/departements.py @@ -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//etudiants/liste", methods=["GET"]) -@bp.route("/departements//etudiants/liste/", methods=["GET"]) +@bp.route( + "/departements//etudiants/liste/", 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//formations//referentiel_competences", methods=["GET"]) +@bp.route( + "/departements//formations//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,11 +184,14 @@ def referenciel_competences(dept: str, formation_id: int): # return jsonify(ref.to_dict()) -@bp.route("/departements//formsemestre//programme", methods=["GET"]) +@bp.route( + "/departements//formsemestre//programme", + methods=["GET"], +) # @permission_required(Permission.APIView) def semestre_index(dept: str, formsemestre_id: int): """ Retourne la liste des Ues, ressources et SAE d'un semestre """ - return error_response(501, message="not implemented") \ No newline at end of file + return error_response(501, message="not implemented") diff --git a/app/api/test_api.py b/app/api/test_api.py index e269412fe..821e3a01d 100644 --- a/app/api/test_api.py +++ b/app/api/test_api.py @@ -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 @@ -25,7 +29,7 @@ def get_token(): r0 = requests.post( SCODOC_URL + "/ScoDoc/api/tokens", auth=(SCODOC_USER, SCODOC_PASSWORD) - ) + ) token = r0.json()["token"] HEADERS = {"Authorization": f"Bearer {token}"} @@ -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,15 +198,25 @@ 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" + if r1.status_code == 200: # Si la requête est "OK" # On récupère la liste des étudiants etudiants = r1.json() @@ -180,15 +226,17 @@ 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" + if r2.status_code == 200: # Si la requête est "OK" # On récupère la liste des étudiants etudiants = r2.json() @@ -216,10 +264,14 @@ 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), + ) @bp.route("/test_liste_semestre_index") @@ -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) - ) \ No newline at end of file + r4 = requests.post(SCODOC_URL + "/ScoDoc/api", auth=(SCODOC_USER, SCODOC_PASSWORD)) diff --git a/tests/api/exemple-api-basic.py b/tests/api/exemple-api-basic.py index 0975e1003..88ba892f6 100644 --- a/tests/api/exemple-api-basic.py +++ b/tests/api/exemple-api-basic.py @@ -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") diff --git a/tests/api/setup_test_api.py b/tests/api/setup_test_api.py index 5338f6ff5..8ca163586 100644 --- a/tests/api/setup_test_api.py +++ b/tests/api/setup_test_api.py @@ -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() \ No newline at end of file + +HEADERS = get_token() diff --git a/tests/api/test_api_absences.py b/tests/api/test_api_absences.py index 3f8a8f0a4..bbe1588ef 100644 --- a/tests/api/test_api_absences.py +++ b/tests/api/test_api_absences.py @@ -18,126 +18,156 @@ 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/", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/absences/etudid/", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/absences/nip/", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/absences/nip/", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/absences/ine/", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/absences/ine/", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 # absences_justify def test_absences_justify(): r = requests.get( - SCODOC_URL + "/ScoDoc/api/absences/etudid//abs_just_only", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/absences/etudid//abs_just_only", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/absences/nip//abs_just_only", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/absences/nip//abs_just_only", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/absences/ine//abs_just_only", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/absences/ine//abs_just_only", + 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=&date=&matin=&justif=" - "&description=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/absences/abs_signale?etudid=&date=&matin=&justif=" + "&description=", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/absences/abs_signale?nip=&date=&matin=&justif=" - "&description=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/absences/abs_signale?nip=&date=&matin=&justif=" + "&description=", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/absences/abs_signale?ine=&date=&matin=&justif=" - "&description=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/absences/abs_signale?ine=&date=&matin=&justif=" + "&description=", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/absences/abs_signale?ine=&date=&matin=&justif=" - "&description=&moduleimpl_id=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/absences/abs_signale?ine=&date=&matin=&justif=" + "&description=&moduleimpl_id=", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 # abs_annule def test_abs_annule(): r = requests.get( - SCODOC_URL + "/ScoDoc/api/absences/abs_annule?etudid=&jour=&matin=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/absences/abs_annule?etudid=&jour=&matin=", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/absences/abs_annule?nip=&jour=&matin=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/absences/abs_annule?nip=&jour=&matin=", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/absences/abs_annule?ine=&jour=&matin=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/absences/abs_annule?ine=&jour=&matin=", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 # abs_annule_justif def test_abs_annule_justif(): r = requests.get( - SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?etudid=&jour=&matin=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/absences/abs_annule_justif?etudid=&jour=&matin=", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?nip=&jour=&matin=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/absences/abs_annule_justif?nip=&jour=&matin=", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?ine=&jour=&matin=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/absences/abs_annule_justif?ine=&jour=&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=&date_debut=date_debut&date_fin=date_fin", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/absences/abs_group_etat/?group_id=&date_debut=date_debut&date_fin=date_fin", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 diff --git a/tests/api/test_api_departements.py b/tests/api/test_api_departements.py index b35e6959e..1e5e901ef 100644 --- a/tests/api/test_api_departements.py +++ b/tests/api/test_api_departements.py @@ -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 @@ -34,16 +36,18 @@ def test_departements(): # liste_etudiants def test_liste_etudiants(): r = requests.get( - SCODOC_URL + "/ScoDoc/api/departements/TAPI/etudiants/liste", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/departements/TAPI/etudiants/liste", + 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 - ) + SCODOC_URL + "/ScoDoc/api/departements/TAPI/etudiants/liste/1", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 assert len(r.json()) == 16 @@ -51,9 +55,10 @@ def test_liste_etudiants(): # liste_semestres_courant def test_semestres_courant(): r = requests.get( - SCODOC_URL + "/ScoDoc/api/departements/TAPI/semestres_courants", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/departements/TAPI/semestres_courants", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 assert len(r.json()) == 1 @@ -61,9 +66,11 @@ 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 - - - - - - - - - - - - - - - - - - diff --git a/tests/api/test_api_etudiants.py b/tests/api/test_api_etudiants.py index f58c6e62e..9c93804ff 100644 --- a/tests/api/test_api_etudiants.py +++ b/tests/api/test_api_etudiants.py @@ -19,23 +19,34 @@ 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 # 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", - "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 @@ -110,29 +124,29 @@ def test_etudiant_formsemestres(): # assert len(r.json()) == 1 - # r = requests.get( - # SCODOC_URL + "/ScoDoc/api/etudiant/nip//formsemestre//bulletin", - # headers=HEADERS, verify=CHECK_CERTIFICATE - # ) - # assert r.status_code == 200 - # - # r = requests.get( - # SCODOC_URL + "/ScoDoc/api/etudiant/ine//formsemestre//bulletin", - # headers=HEADERS, verify=CHECK_CERTIFICATE - # ) - # assert r.status_code == 200 +# r = requests.get( +# SCODOC_URL + "/ScoDoc/api/etudiant/nip//formsemestre//bulletin", +# headers=HEADERS, verify=CHECK_CERTIFICATE +# ) +# assert r.status_code == 200 +# +# r = requests.get( +# SCODOC_URL + "/ScoDoc/api/etudiant/ine//formsemestre//bulletin", +# headers=HEADERS, verify=CHECK_CERTIFICATE +# ) +# assert r.status_code == 200 # etudiant_groups 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//semestre//groups", # headers=HEADERS, verify=CHECK_CERTIFICATE diff --git a/tests/api/test_api_evaluations.py b/tests/api/test_api_evaluations.py index 50b8ad52d..0d67bc1ca 100644 --- a/tests/api/test_api_evaluations.py +++ b/tests/api/test_api_evaluations.py @@ -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/", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/evaluations/", + 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/", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/evaluations/eval_notes/", + 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=&etudid=¬e=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=&etudid=¬e=", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=&nip=¬e=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=&nip=¬e=", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=&ine=¬e=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=&ine=¬e=", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 diff --git a/tests/api/test_api_formations.py b/tests/api/test_api_formations.py index 2afe7602f..14aa22852 100644 --- a/tests/api/test_api_formations.py +++ b/tests/api/test_api_formations.py @@ -18,55 +18,65 @@ 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 - ) + SCODOC_URL + "/ScoDoc/api/formations", + 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/", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/formations/", + 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/", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/formations/formation_export/", + 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/", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/formations/apo/", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 # moduleimpls def test_moduleimpls(): r = requests.get( - SCODOC_URL + "/ScoDoc/api/formations/moduleimpl/", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/formations/moduleimpl/", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 # moduleimpls_sem def test_moduleimpls_sem(): r = requests.get( - SCODOC_URL + "/ScoDoc/api/formations/moduleimpl//formsemestre/", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) - assert r.status_code == 200 \ No newline at end of file + SCODOC_URL + + "/ScoDoc/api/formations/moduleimpl//formsemestre/", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) + assert r.status_code == 200 diff --git a/tests/api/test_api_formsemestre_.py b/tests/api/test_api_formsemestre_.py index 5cd40c2ae..d703ac7ed 100644 --- a/tests/api/test_api_formsemestre_.py +++ b/tests/api/test_api_formsemestre_.py @@ -18,50 +18,61 @@ 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/", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/formations/formsemestre/", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 + # etudiant_bulletin def test_etudiant_bulletin(): r = requests.get( - SCODOC_URL + "/ScoDoc/api/formsemestre//departements//etudiant/etudid//bulletin", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/formsemestre//departements//etudiant/etudid//bulletin", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/formsemestre//departements//etudiant/nip//bulletin", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/formsemestre//departements//etudiant/nip//bulletin", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/formsemestre//departements//etudiant/ine//bulletin", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/formsemestre//departements//etudiant/ine//bulletin", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 + # bulletins def test_bulletins(): r = requests.get( - SCODOC_URL + "/ScoDoc/api/formsemestre//bulletins", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/formsemestre//bulletins", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 # jury def test_jury(): r = requests.get( - SCODOC_URL + "/ScoDoc/api/formsemestre//jury", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) - assert r.status_code == 200 \ No newline at end of file + SCODOC_URL + "/ScoDoc/api/formsemestre//jury", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) + assert r.status_code == 200 diff --git a/tests/api/test_api_jury.py b/tests/api/test_api_jury.py index f128d27d2..e9be6a017 100644 --- a/tests/api/test_api_jury.py +++ b/tests/api/test_api_jury.py @@ -18,66 +18,83 @@ 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//preparation_jury", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/jury/formsemestre//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//decisions_jury", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/jury/formsemestre//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=&formsemestre_id=" - "&jury=&devenir=&assiduite=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/jury/set_decision/etudid?etudid=&formsemestre_id=" + "&jury=&devenir=&assiduite=", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/jury/set_decision/nip?etudid=&formsemestre_id=" - "&jury=&devenir=&assiduite=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/jury/set_decision/nip?etudid=&formsemestre_id=" + "&jury=&devenir=&assiduite=", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/jury/set_decision/ine?etudid=&formsemestre_id=" - "&jury=&devenir=&assiduite=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/jury/set_decision/ine?etudid=&formsemestre_id=" + "&jury=&devenir=&assiduite=", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 # annule_decision_jury def test_annule_decision_jury(): r = requests.get( - SCODOC_URL + "/ScoDoc/api/jury/etudid//formsemestre//annule_decision", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) - assert r.status_code == 200 - - - r = requests.get( - SCODOC_URL + "/ScoDoc/api/jury/nip//formsemestre//annule_decision", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + + "/ScoDoc/api/jury/etudid//formsemestre//annule_decision", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/jury/ine//formsemestre//annule_decision", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) - assert r.status_code == 200 \ No newline at end of file + SCODOC_URL + + "/ScoDoc/api/jury/nip//formsemestre//annule_decision", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) + assert r.status_code == 200 + + r = requests.get( + SCODOC_URL + + "/ScoDoc/api/jury/ine//formsemestre//annule_decision", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) + assert r.status_code == 200 diff --git a/tests/api/test_api_logos.py b/tests/api/test_api_logos.py index 22fcf709d..0e2250ffd 100644 --- a/tests/api/test_api_logos.py +++ b/tests/api/test_api_logos.py @@ -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 ( diff --git a/tests/api/test_api_partitions.py b/tests/api/test_api_partitions.py index a3c33518b..626ab9e3f 100644 --- a/tests/api/test_api_partitions.py +++ b/tests/api/test_api_partitions.py @@ -18,36 +18,42 @@ 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/", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/partitions/", + 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/", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/partitions/groups/", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 r = requests.get( - SCODOC_URL + "/ScoDoc/api/partitions/groups//etat/", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) + SCODOC_URL + "/ScoDoc/api/partitions/groups//etat/", + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) assert r.status_code == 200 # set_groups def test_set_groups(): r = requests.get( - SCODOC_URL + "/ScoDoc/api/partitions/set_groups?partition_id=&groups_lists=&" + SCODOC_URL + + "/ScoDoc/api/partitions/set_groups?partition_id=&groups_lists=&" "groups_to_create=&groups_to_delete=", - headers=HEADERS, verify=CHECK_CERTIFICATE - ) - assert r.status_code == 200 \ No newline at end of file + headers=HEADERS, + verify=CHECK_CERTIFICATE, + ) + assert r.status_code == 200