1
0
forked from ScoDoc/ScoDoc

création des fichiers tests et des requêtes aux routes de l'api

This commit is contained in:
leonard_montalbano 2022-03-09 16:52:07 +01:00
parent 28ec8a482a
commit f9817966cf
10 changed files with 722 additions and 5 deletions

View File

@ -8,8 +8,8 @@ from app.api import bp, requested_format
from app.api.auth import token_auth from app.api.auth import token_auth
from app.api.errors import error_response from app.api.errors import error_response
SCODOC_USER = "admin" SCODOC_USER = ""
SCODOC_PASSWORD = "admin" SCODOC_PASSWORD = ""
SCODOC_URL = "http://192.168.1.12:5000" SCODOC_URL = "http://192.168.1.12:5000"
CHECK_CERTIFICATE = bool(int(os.environ.get("CHECK_CERTIFICATE", False))) 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 Permet de set le token dans le header
""" """
global HEADERS 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)
) )
@ -40,15 +43,22 @@ def get_departement():
get_token() get_token()
global HEADERS print("ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé")
print(HEADERS) global HEADERS
global CHECK_CERTIFICATE
global SCODOC_USER
global SCODOC_PASSWORD
# print(HEADERS)
# 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,
) )
print("iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii")
if r.status_code == 200: if r.status_code == 200:
dept_id = r.json()[0] dept_id = r.json()[0]
# print(dept_id) # print(dept_id)

View File

@ -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}"}

View File

@ -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/<int:etudid>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/nip/<int:nip>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/ine/<int:ine>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# absences_justify
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/etudid/<int:etudid>/abs_just_only",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/nip/<int:nip>/abs_just_only",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/ine/<int: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=<int:etudid>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
"&description=<string:description>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/abs_signale?nip=<int:nip>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
"&description=<string:description>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
"&description=<string:description>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
"&description=<string:description>&moduleimpl_id=<int: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=<int:etudid>&jour=<string:jour>&matin=<string:matin>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/abs_annule?nip=<int:nip>&jour=<string:jour>&matin=<string:matin>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/abs_annule?ine=<int:ine>&jour=<string:jour>&matin=<string: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=<int:etudid>&jour=<string:jour>&matin=<string:matin>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?nip=<int:nip>&jour=<string:jour>&matin=<string:matin>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?ine=<int:ine>&jour=<string:jour>&matin=<string:matin>",
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=<int:group_id>&date_debut=date_debut&date_fin=date_fin",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200

View File

@ -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/<string:dept>/etudiants/liste",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/departements/<string:dept>/etudiants/liste/<int:formsemestre_id>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# liste_semestres_courant
r = requests.get(
SCODOC_URL + "/ScoDoc/api/departements/<string:dept>/etudiants/liste/<int:formsemestre_id>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# referenciel_competences
r = requests.get(
SCODOC_URL + "/ScoDoc/api/departements/<string:dept>/formations/<int:formation_id>/referentiel_competences",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# semestre_index
r = requests.get(
SCODOC_URL + "/ScoDoc/api/departements/<string:dept>/formsemestre/<string:formsemestre_id>/programme",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200

View File

@ -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/<int:etudid>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# etudiant_formsemestres
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/<int:etudid>/formsemestres",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/formsemestres",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>/formsemestres",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# etudiant_bulletin_semestre
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# etudiant_groups
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/<int:etudid>/semestre/<int:formsemestre_id>/groups",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/semestre/<int:formsemestre_id>/groups",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>/semestre/<int:formsemestre_id>/groups",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200

View File

@ -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/<int:moduleimpl_id>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# evaluation_notes
r = requests.get(
SCODOC_URL + "/ScoDoc/api/evaluations/eval_notes/<int:evaluation_id>",
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=<int:eval_id>&etudid=<int:etudid>&note=<float:note>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=<int:eval_id>&nip=<int:nip>&note=<float:note>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/evaluations/eval_set_notes?eval_id=<int:eval_id>&ine=<int:ine>&note=<float:note>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200

View File

@ -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/<int:formation_id>",
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/<int:formation_id>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# formsemestre_apo
r = requests.get(
SCODOC_URL + "/ScoDoc/api/formations/apo/<string:etape_apo>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# moduleimpls
r = requests.get(
SCODOC_URL + "/ScoDoc/api/formations/moduleimpl/<int:moduleimpl_id>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# moduleimpls_sem
r = requests.get(
SCODOC_URL + "/ScoDoc/api/formations/moduleimpl/<int:moduleimpl_id>/formsemestre/<int:formsemestre_id>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200

View File

@ -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/<int:formsemestre_id>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# etudiant_bulletin
r = requests.get(
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/etudid/<int:etudid>/bulletin",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/nip/<int:nip>/bulletin",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/ine/<int:ine>/bulletin",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# bulletins
r = requests.get(
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/bulletins",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# jury
r = requests.get(
SCODOC_URL + "/ScoDoc/api/formsemestre/<int:formsemestre_id>/jury",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200

View File

@ -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/<int:formsemestre_id>/preparation_jury",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# jury_decisions
r = requests.get(
SCODOC_URL + "/ScoDoc/api/jury/formsemestre/<int:formsemestre_id>/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=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/jury/set_decision/nip?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/jury/set_decision/ine?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# annule_decision_jury
r = requests.get(
SCODOC_URL + "/ScoDoc/api/jury/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/annule_decision",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/jury/nip/<int:nip>/formsemestre/<int:formsemestre_id>/annule_decision",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/jury/ine/<int:ine>/formsemestre/<int:formsemestre_id>/annule_decision",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200

View File

@ -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/<int:formsemestre_id>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
# etud_in_group
r = requests.get(
SCODOC_URL + "/ScoDoc/api/partitions/groups/<int:group_id>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/partitions/groups/<int:group_id>/etat/<string: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=<int:partition_id>&groups_lists=<int:groups_lists>&"
"groups_to_create=<int:groups_to_create>&groups_to_delete=<int:groups_to_delete>",
auth=(SCODOC_USER, SCODOC_PASSWORD)
)
assert r.status_code == 200