forked from ScoDoc/ScoDoc
72 lines
1.6 KiB
Python
72 lines
1.6 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_evaluations.py
|
|
"""
|
|
|
|
import requests
|
|
|
|
from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
|
|
from tests.api.tools_test_api import verify_fields
|
|
|
|
|
|
# evaluations
|
|
def test_evaluations():
|
|
fields = [
|
|
"moduleimpl_id",
|
|
"jour",
|
|
"heure_debut",
|
|
"description",
|
|
"coefficient",
|
|
"publish_incomplete",
|
|
"numero",
|
|
"id",
|
|
"heure_fin",
|
|
"note_max",
|
|
"visibulletin",
|
|
"evaluation_type",
|
|
"evaluation_id",
|
|
"jouriso",
|
|
"duree",
|
|
"descrheure",
|
|
"matin",
|
|
"apresmidi",
|
|
]
|
|
|
|
r = requests.get(
|
|
SCODOC_URL + "/ScoDoc/api/evaluations/1",
|
|
headers=HEADERS,
|
|
verify=CHECK_CERTIFICATE,
|
|
)
|
|
|
|
eval = r.json()[0]
|
|
|
|
fields_OK = verify_fields(eval, fields)
|
|
|
|
assert r.status_code == 200
|
|
# assert len(r.json()) == 1
|
|
assert fields_OK is True
|
|
|
|
|
|
# evaluation_notes
|
|
def test_evaluation_notes():
|
|
r = requests.get(
|
|
SCODOC_URL + "/ScoDoc/api/evaluations/eval_notes/1",
|
|
headers=HEADERS,
|
|
verify=CHECK_CERTIFICATE,
|
|
)
|
|
assert r.status_code == 200
|