2022-03-09 16:52:07 +01:00
|
|
|
# -*- 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
|
|
|
|
"""
|
|
|
|
|
2022-03-10 17:43:12 +01:00
|
|
|
import requests
|
|
|
|
from tests.api.setup_test_api import SCODOC_URL, HEADERS, CHECK_CERTIFICATE
|
2022-03-09 16:52:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
# absences
|
2022-03-10 17:43:12 +01:00
|
|
|
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
|
2022-03-09 16:52:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
# absences_justify
|
2022-03-10 17:43:12 +01:00
|
|
|
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
|
2022-03-09 16:52:07 +01:00
|
|
|
|
|
|
|
# abs_signale
|
2022-03-10 17:43:12 +01:00
|
|
|
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
|
2022-03-09 16:52:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
# abs_annule
|
2022-03-10 17:43:12 +01:00
|
|
|
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
|
2022-03-09 16:52:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
# abs_annule_justif
|
2022-03-10 17:43:12 +01:00
|
|
|
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
|
2022-03-09 16:52:07 +01:00
|
|
|
|
|
|
|
# abs_groupe_etat
|
2022-03-10 17:43:12 +01:00
|
|
|
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
|