DocScoDoc/tests/api/test_api_absences.py

144 lines
4.8 KiB
Python

# -*- 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 requests
from tests.api.setup_test_api import SCODOC_URL, HEADERS, CHECK_CERTIFICATE
# absences
def test_absences():
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/etudid/<int:etudid>",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/nip/<int:nip>",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/ine/<int: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/<int:etudid>/abs_just_only",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/nip/<int:nip>/abs_just_only",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/ine/<int: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=<int:etudid>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
"&description=<string:description>",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/abs_signale?nip=<int:nip>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
"&description=<string:description>",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
"&description=<string:description>",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
"&description=<string:description>&moduleimpl_id=<int: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=<int:etudid>&jour=<string:jour>&matin=<string:matin>",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/abs_annule?nip=<int:nip>&jour=<string:jour>&matin=<string:matin>",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/abs_annule?ine=<int:ine>&jour=<string:jour>&matin=<string:matin>",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
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=<int:etudid>&jour=<string:jour>&matin=<string:matin>",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?nip=<int:nip>&jour=<string:jour>&matin=<string:matin>",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/abs_annule_justif?ine=<int:ine>&jour=<string:jour>&matin=<string:matin>",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
# abs_groupe_etat
def test_abs_groupe_etat():
r = requests.get(
SCODOC_URL + "/ScoDoc/api/absences/abs_group_etat/?group_id=<int:group_id>&date_debut=date_debut&date_fin=date_fin",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200