ScoDoc/tests/api/test_api_etudiants.py

120 lines
3.7 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_etudiants.py
"""
import requests
from tests.api.setup_test_api import SCODOC_URL, HEADERS, CHECK_CERTIFICATE
# etudiants
def test_etudiants():
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiants",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
# etudiants_courant
def test_etudiants_courant():
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiants/courant",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
# etudiant
def test_etudiant():
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
# r = requests.get(
# SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>",
# headers=HEADERS, verify=CHECK_CERTIFICATE
# )
# assert r.status_code == 200
# r = requests.get(
# SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>",
# headers=HEADERS, verify=CHECK_CERTIFICATE
# )
# assert r.status_code == 200
# etudiant_formsemestres
def test_etudiant_formsemestres():
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1/formsemestres",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
# r = requests.get(
# SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/formsemestres",
# headers=HEADERS, verify=CHECK_CERTIFICATE
# )
# assert r.status_code == 200
#
# r = requests.get(
# SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>/formsemestres",
# headers=HEADERS, verify=CHECK_CERTIFICATE
# )
# assert r.status_code == 200
# etudiant_bulletin_semestre
def test_etudiant_bulletin_semestre():
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1/formsemestre/1/bulletin",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
# r = requests.get(
# SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin",
# headers=HEADERS, verify=CHECK_CERTIFICATE
# )
# assert r.status_code == 200
#
# r = requests.get(
# SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin",
# headers=HEADERS, verify=CHECK_CERTIFICATE
# )
# assert r.status_code == 200
# etudiant_groups
def test_etudiant_groups():
r = requests.get(
SCODOC_URL + "/ScoDoc/api/etudiant/etudid/1/semestre/1/groups",
headers=HEADERS, verify=CHECK_CERTIFICATE
)
assert r.status_code == 200
# r = requests.get(
# SCODOC_URL + "/ScoDoc/api/etudiant/nip/<int:nip>/semestre/<int:formsemestre_id>/groups",
# headers=HEADERS, verify=CHECK_CERTIFICATE
# )
# assert r.status_code == 200
#
# r = requests.get(
# SCODOC_URL + "/ScoDoc/api/etudiant/ine/<int:ine>/semestre/<int:formsemestre_id>/groups",
# headers=HEADERS, verify=CHECK_CERTIFICATE
# )
# assert r.status_code == 200