DocScoDoc/tests/api/test_api_absences.py

141 lines
4.4 KiB
Python
Raw Normal View History

# -*- 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