From f9817966cfa51453cae8bc2d45eca6e75a4d0755 Mon Sep 17 00:00:00 2001 From: leonard_montalbano Date: Wed, 9 Mar 2022 16:52:07 +0100 Subject: [PATCH] =?UTF-8?q?cr=C3=A9ation=20des=20fichiers=20tests=20et=20d?= =?UTF-8?q?es=20requ=C3=AAtes=20aux=20routes=20de=20l'api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/test_api.py | 20 +++- tests/api/setup_test_api.py | 38 ++++++++ tests/api/test_api_absences.py | 140 ++++++++++++++++++++++++++++ tests/api/test_api_departements.py | 89 ++++++++++++++++++ tests/api/test_api_etudiants.py | 116 +++++++++++++++++++++++ tests/api/test_api_evaluations.py | 58 ++++++++++++ tests/api/test_api_formations.py | 67 +++++++++++++ tests/api/test_api_formsemestre_.py | 66 +++++++++++++ tests/api/test_api_jury.py | 81 ++++++++++++++++ tests/api/test_api_partitions.py | 52 +++++++++++ 10 files changed, 722 insertions(+), 5 deletions(-) create mode 100644 tests/api/setup_test_api.py create mode 100644 tests/api/test_api_absences.py create mode 100644 tests/api/test_api_departements.py create mode 100644 tests/api/test_api_etudiants.py create mode 100644 tests/api/test_api_evaluations.py create mode 100644 tests/api/test_api_formations.py create mode 100644 tests/api/test_api_formsemestre_.py create mode 100644 tests/api/test_api_jury.py create mode 100644 tests/api/test_api_partitions.py diff --git a/app/api/test_api.py b/app/api/test_api.py index 4f3ff1bd..31df2c68 100644 --- a/app/api/test_api.py +++ b/app/api/test_api.py @@ -8,8 +8,8 @@ from app.api import bp, requested_format from app.api.auth import token_auth from app.api.errors import error_response -SCODOC_USER = "admin" -SCODOC_PASSWORD = "admin" +SCODOC_USER = "" +SCODOC_PASSWORD = "" SCODOC_URL = "http://192.168.1.12:5000" CHECK_CERTIFICATE = bool(int(os.environ.get("CHECK_CERTIFICATE", False))) @@ -20,6 +20,9 @@ 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) ) @@ -40,15 +43,22 @@ def get_departement(): get_token() - global HEADERS + print("ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé") - print(HEADERS) + global HEADERS + global CHECK_CERTIFICATE + global SCODOC_USER + global SCODOC_PASSWORD + + # print(HEADERS) # departements r = requests.get( SCODOC_URL + "/ScoDoc/api/departements", - headers=HEADERS, verify=CHECK_CERTIFICATE + headers=HEADERS, verify=CHECK_CERTIFICATE, ) + print("iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii") + if r.status_code == 200: dept_id = r.json()[0] # print(dept_id) diff --git a/tests/api/setup_test_api.py b/tests/api/setup_test_api.py new file mode 100644 index 00000000..94fd538a --- /dev/null +++ b/tests/api/setup_test_api.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +"""Test Logos + +Utilisation : + créer les variables d'environnement: (indiquer les valeurs + pour le serveur ScoDoc que vous voulez interroger) + + export SCODOC_URL="https://scodoc.xxx.net/" + export SCODOC_USER="xxx" + export SCODOC_PASSWD="xxx" + export CHECK_CERTIFICATE=0 # ou 1 si serveur de production avec certif SSL valide + + (on peut aussi placer ces valeurs dans un fichier .env du répertoire tests/api). +""" +import os +import requests + +SCODOC_USER = "" +SCODOC_PASSWORD = "" +SCODOC_URL = "" +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}"} \ No newline at end of file diff --git a/tests/api/test_api_absences.py b/tests/api/test_api_absences.py new file mode 100644 index 00000000..4d3fb36b --- /dev/null +++ b/tests/api/test_api_absences.py @@ -0,0 +1,140 @@ +# -*- coding: utf-8 -*- + +"""Test Logos + +Utilisation : + créer les variables d'environnement: (indiquer les valeurs + pour le serveur ScoDoc que vous voulez interroger) + + export SCODOC_URL="https://scodoc.xxx.net/" + export SCODOC_USER="xxx" + export SCODOC_PASSWD="xxx" + export CHECK_CERTIFICATE=0 # ou 1 si serveur de production avec certif SSL valide + + (on peut aussi placer ces valeurs dans un fichier .env du répertoire tests/api). + + Lancer : + pytest tests/api/test_api_absences.py +""" +import os +import requests +from tests.api.setup_test_api import SCODOC_URL, SCODOC_USER, SCODOC_PASSWORD, get_token + + + +############################################# Absences ################################ + +# absences +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/etudid/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/nip/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/ine/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + +# absences_justify +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/etudid//abs_just_only", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/nip//abs_just_only", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/ine//abs_just_only", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +# abs_signale +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/abs_signale?etudid=&date=&matin=&justif=" + "&description=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/abs_signale?nip=&date=&matin=&justif=" + "&description=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/abs_signale?ine=&date=&matin=&justif=" + "&description=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/abs_signale?ine=&date=&matin=&justif=" + "&description=&moduleimpl_id=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + +# abs_annule +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/abs_annule?etudid=&jour=&matin=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/abs_annule?nip=&jour=&matin=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/abs_annule?ine=&jour=&matin=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + +# abs_annule_justif +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?etudid=&jour=&matin=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?nip=&jour=&matin=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?ine=&jour=&matin=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +# abs_groupe_etat +r = requests.get( + SCODOC_URL + "/ScoDoc/api/absences/abs_group_etat/?group_id=&date_debut=date_debut&date_fin=date_fin", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 diff --git a/tests/api/test_api_departements.py b/tests/api/test_api_departements.py new file mode 100644 index 00000000..02f4f4b2 --- /dev/null +++ b/tests/api/test_api_departements.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- + +"""Test Logos + +Utilisation : + créer les variables d'environnement: (indiquer les valeurs + pour le serveur ScoDoc que vous voulez interroger) + + export SCODOC_URL="https://scodoc.xxx.net/" + export SCODOC_USER="xxx" + export SCODOC_PASSWD="xxx" + export CHECK_CERTIFICATE=0 # ou 1 si serveur de production avec certif SSL valide + + (on peut aussi placer ces valeurs dans un fichier .env du répertoire tests/api). + + Lancer : + pytest tests/api/test_api_departements.py +""" +import os +import requests +from tests.api.setup_test_api import SCODOC_URL, SCODOC_USER, SCODOC_PASSWORD, get_token + + + + +######################### Départements ###################### + +# departements +r = requests.get( + SCODOC_URL + "/ScoDoc/api/departements", + auth=(SCODOC_USER, SCODOC_PASSWORD) +) +assert r.status_code == 200 + + +# liste_etudiants +r = requests.get( + SCODOC_URL + "/ScoDoc/api/departements//etudiants/liste", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/departements//etudiants/liste/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + +# liste_semestres_courant +r = requests.get( + SCODOC_URL + "/ScoDoc/api/departements//etudiants/liste/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + +# referenciel_competences +r = requests.get( + SCODOC_URL + "/ScoDoc/api/departements//formations//referentiel_competences", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + +# semestre_index +r = requests.get( + SCODOC_URL + "/ScoDoc/api/departements//formsemestre//programme", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + + + + + + + + + + + + + + + + + diff --git a/tests/api/test_api_etudiants.py b/tests/api/test_api_etudiants.py new file mode 100644 index 00000000..610266c9 --- /dev/null +++ b/tests/api/test_api_etudiants.py @@ -0,0 +1,116 @@ +# -*- coding: utf-8 -*- + +"""Test Logos + +Utilisation : + créer les variables d'environnement: (indiquer les valeurs + pour le serveur ScoDoc que vous voulez interroger) + + export SCODOC_URL="https://scodoc.xxx.net/" + export SCODOC_USER="xxx" + export SCODOC_PASSWD="xxx" + export CHECK_CERTIFICATE=0 # ou 1 si serveur de production avec certif SSL valide + + (on peut aussi placer ces valeurs dans un fichier .env du répertoire tests/api). + + Lancer : + pytest tests/api/test_api_etudiants.py +""" +import os +import requests +from tests.api.setup_test_api import SCODOC_URL, SCODOC_USER, SCODOC_PASSWORD, get_token + + +################################## Etudiants #################################### + +# etudiants +r = requests.get( + SCODOC_URL + "/ScoDoc/api/etudiants", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +# etudiants_courant +r = requests.get( + SCODOC_URL + "/ScoDoc/api/etudiants/courant", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +# etudiant +r = requests.get( + SCODOC_URL + "/ScoDoc/api/etudiant/etudid/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/etudiant/nip/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 +r = requests.get( + SCODOC_URL + "/ScoDoc/api/etudiant/ine/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + +# etudiant_formsemestres +r = requests.get( + SCODOC_URL + "/ScoDoc/api/etudiant/etudid//formsemestres", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/etudiant/nip//formsemestres", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/etudiant/ine//formsemestres", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + +# etudiant_bulletin_semestre +r = requests.get( + SCODOC_URL + "/ScoDoc/api/etudiant/etudid//formsemestre//bulletin", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/etudiant/nip//formsemestre//bulletin", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/etudiant/ine//formsemestre//bulletin", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + +# etudiant_groups +r = requests.get( + SCODOC_URL + "/ScoDoc/api/etudiant/etudid//semestre//groups", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/etudiant/nip//semestre//groups", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/etudiant/ine//semestre//groups", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 \ No newline at end of file diff --git a/tests/api/test_api_evaluations.py b/tests/api/test_api_evaluations.py new file mode 100644 index 00000000..b6d0871e --- /dev/null +++ b/tests/api/test_api_evaluations.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- + +"""Test Logos + +Utilisation : + créer les variables d'environnement: (indiquer les valeurs + pour le serveur ScoDoc que vous voulez interroger) + + export SCODOC_URL="https://scodoc.xxx.net/" + export SCODOC_USER="xxx" + export SCODOC_PASSWD="xxx" + export CHECK_CERTIFICATE=0 # ou 1 si serveur de production avec certif SSL valide + + (on peut aussi placer ces valeurs dans un fichier .env du répertoire tests/api). + + Lancer : + pytest tests/api/test_api_evaluations.py +""" +import os +import requests +from tests.api.setup_test_api import SCODOC_URL, SCODOC_USER, SCODOC_PASSWORD, get_token + + + +##################################### Evaluations ################################ + +# evaluations +r = requests.get( + SCODOC_URL + "/ScoDoc/api/evaluations/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +# evaluation_notes +r = requests.get( + SCODOC_URL + "/ScoDoc/api/evaluations/eval_notes/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +# evaluation_set_notes +r = requests.get( + SCODOC_URL + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=&etudid=¬e=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=&nip=¬e=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=&ine=¬e=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 diff --git a/tests/api/test_api_formations.py b/tests/api/test_api_formations.py new file mode 100644 index 00000000..3c6d455a --- /dev/null +++ b/tests/api/test_api_formations.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- + +"""Test Logos + +Utilisation : + créer les variables d'environnement: (indiquer les valeurs + pour le serveur ScoDoc que vous voulez interroger) + + export SCODOC_URL="https://scodoc.xxx.net/" + export SCODOC_USER="xxx" + export SCODOC_PASSWD="xxx" + export CHECK_CERTIFICATE=0 # ou 1 si serveur de production avec certif SSL valide + + (on peut aussi placer ces valeurs dans un fichier .env du répertoire tests/api). + + Lancer : + pytest tests/api/test_api_formations.py +""" +import os +import requests +from tests.api.setup_test_api import SCODOC_URL, SCODOC_USER, SCODOC_PASSWORD, get_token + +##################################### Formations ############################ + +# formations +r = requests.get( + SCODOC_URL + "/ScoDoc/api/formations", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +# formations_by_id +r = requests.get( + SCODOC_URL + "/ScoDoc/api/formations/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +# formation_export_by_formation_id +r = requests.get( + SCODOC_URL + "/ScoDoc/api/formations/formation_export/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +# formsemestre_apo +r = requests.get( + SCODOC_URL + "/ScoDoc/api/formations/apo/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + +# moduleimpls +r = requests.get( + SCODOC_URL + "/ScoDoc/api/formations/moduleimpl/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + +# moduleimpls_sem +r = requests.get( + SCODOC_URL + "/ScoDoc/api/formations/moduleimpl//formsemestre/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 \ No newline at end of file diff --git a/tests/api/test_api_formsemestre_.py b/tests/api/test_api_formsemestre_.py new file mode 100644 index 00000000..73df0ab2 --- /dev/null +++ b/tests/api/test_api_formsemestre_.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- + +"""Test Logos + +Utilisation : + créer les variables d'environnement: (indiquer les valeurs + pour le serveur ScoDoc que vous voulez interroger) + + export SCODOC_URL="https://scodoc.xxx.net/" + export SCODOC_USER="xxx" + export SCODOC_PASSWD="xxx" + export CHECK_CERTIFICATE=0 # ou 1 si serveur de production avec certif SSL valide + + (on peut aussi placer ces valeurs dans un fichier .env du répertoire tests/api). + + Lancer : + pytest tests/api/test_api_formsemestre.py +""" +import os +import requests +from tests.api.setup_test_api import SCODOC_URL, SCODOC_USER, SCODOC_PASSWORD, get_token + + + +############################## Formsemestre ############################### + +# formsemestre +r = requests.get( + SCODOC_URL + "/ScoDoc/api/formations/formsemestre/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +# etudiant_bulletin +r = requests.get( + SCODOC_URL + "/ScoDoc/api/formsemestre//departements//etudiant/etudid//bulletin", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/formsemestre//departements//etudiant/nip//bulletin", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/formsemestre//departements//etudiant/ine//bulletin", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +# bulletins +r = requests.get( + SCODOC_URL + "/ScoDoc/api/formsemestre//bulletins", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + +# jury +r = requests.get( + SCODOC_URL + "/ScoDoc/api/formsemestre//jury", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 \ No newline at end of file diff --git a/tests/api/test_api_jury.py b/tests/api/test_api_jury.py new file mode 100644 index 00000000..8d006c21 --- /dev/null +++ b/tests/api/test_api_jury.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- + +"""Test Logos + +Utilisation : + créer les variables d'environnement: (indiquer les valeurs + pour le serveur ScoDoc que vous voulez interroger) + + export SCODOC_URL="https://scodoc.xxx.net/" + export SCODOC_USER="xxx" + export SCODOC_PASSWD="xxx" + export CHECK_CERTIFICATE=0 # ou 1 si serveur de production avec certif SSL valide + + (on peut aussi placer ces valeurs dans un fichier .env du répertoire tests/api). + + Lancer : + pytest tests/api/test_api_jury.py +""" +import os +import requests +from tests.api.setup_test_api import SCODOC_URL, SCODOC_USER, SCODOC_PASSWORD, get_token + + +################################## Jury ###################################### + +# jury_preparation +r = requests.get( + SCODOC_URL + "/ScoDoc/api/jury/formsemestre//preparation_jury", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +# jury_decisions +r = requests.get( + SCODOC_URL + "/ScoDoc/api/jury/formsemestre//decisions_jury", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +# set_decision_jury +r = requests.get( + SCODOC_URL + "/ScoDoc/api/jury/set_decision/etudid?etudid=&formsemestre_id=" + "&jury=&devenir=&assiduite=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/jury/set_decision/nip?etudid=&formsemestre_id=" + "&jury=&devenir=&assiduite=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/jury/set_decision/ine?etudid=&formsemestre_id=" + "&jury=&devenir=&assiduite=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + +# annule_decision_jury +r = requests.get( + SCODOC_URL + "/ScoDoc/api/jury/etudid//formsemestre//annule_decision", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/jury/nip//formsemestre//annule_decision", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +r = requests.get( + SCODOC_URL + "/ScoDoc/api/jury/ine//formsemestre//annule_decision", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 \ No newline at end of file diff --git a/tests/api/test_api_partitions.py b/tests/api/test_api_partitions.py new file mode 100644 index 00000000..025fe962 --- /dev/null +++ b/tests/api/test_api_partitions.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- + +"""Test Logos + +Utilisation : + créer les variables d'environnement: (indiquer les valeurs + pour le serveur ScoDoc que vous voulez interroger) + + export SCODOC_URL="https://scodoc.xxx.net/" + export SCODOC_USER="xxx" + export SCODOC_PASSWD="xxx" + export CHECK_CERTIFICATE=0 # ou 1 si serveur de production avec certif SSL valide + + (on peut aussi placer ces valeurs dans un fichier .env du répertoire tests/api). + + Lancer : + pytest tests/api/test_api_partitions.py +""" +import os +import requests +from tests.api.setup_test_api import SCODOC_URL, SCODOC_USER, SCODOC_PASSWORD, get_token + + +############################# Partitions #################################### + +# partition +r = requests.get( + SCODOC_URL + "/ScoDoc/api/partitions/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + +# etud_in_group +r = requests.get( + SCODOC_URL + "/ScoDoc/api/partitions/groups/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 +r = requests.get( + SCODOC_URL + "/ScoDoc/api/partitions/groups//etat/", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 + + +# set_groups +r = requests.get( + SCODOC_URL + "/ScoDoc/api/partitions/set_groups?partition_id=&groups_lists=&" + "groups_to_create=&groups_to_delete=", + auth=(SCODOC_USER, SCODOC_PASSWORD) + ) +assert r.status_code == 200 \ No newline at end of file