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_formsemestre.py
|
|
|
|
"""
|
|
|
|
|
2022-03-10 17:43:12 +01:00
|
|
|
import requests
|
2022-05-05 20:06:49 +02:00
|
|
|
from app.api.formsemestres import formsemestre
|
2022-03-09 16:52:07 +01:00
|
|
|
|
2022-05-04 23:11:20 +02:00
|
|
|
from tests.api.setup_test_api import API_URL, CHECK_CERTIFICATE, api_headers
|
2022-06-10 16:35:28 +02:00
|
|
|
from tests.api.tools_test_api import (
|
|
|
|
MODIMPL_FIELDS,
|
|
|
|
verify_fields,
|
|
|
|
EVAL_FIELDS,
|
|
|
|
SAISIE_NOTES_FIELDS,
|
2022-06-22 16:26:50 +02:00
|
|
|
FORMSEMESTRE_ETUS_FIELDS,
|
2022-06-10 16:35:28 +02:00
|
|
|
)
|
2022-05-05 20:06:49 +02:00
|
|
|
from tests.api.tools_test_api import FSEM_FIELDS, UE_FIELDS, MODULE_FIELDS
|
2022-05-02 16:29:26 +02:00
|
|
|
|
2022-05-11 00:59:51 +02:00
|
|
|
# Etudiant pour les tests
|
|
|
|
ETUDID = 1
|
|
|
|
NIP = "1"
|
|
|
|
INE = "INE1"
|
|
|
|
|
2022-05-04 23:11:20 +02:00
|
|
|
|
|
|
|
def test_formsemestre(api_headers):
|
|
|
|
"""
|
2022-05-05 19:50:09 +02:00
|
|
|
Route: /formsemestre/<id>
|
2022-05-04 23:11:20 +02:00
|
|
|
"""
|
2022-06-27 16:12:41 +02:00
|
|
|
formsemestre_id = 1
|
2022-03-10 17:43:12 +01:00
|
|
|
r = requests.get(
|
2022-06-27 16:12:41 +02:00
|
|
|
f"{API_URL}/formsemestre/{formsemestre_id}",
|
2022-05-04 23:11:20 +02:00
|
|
|
headers=api_headers,
|
2022-04-13 12:39:10 +02:00
|
|
|
verify=CHECK_CERTIFICATE,
|
|
|
|
)
|
2022-03-10 17:43:12 +01:00
|
|
|
assert r.status_code == 200
|
2022-04-20 15:50:02 +02:00
|
|
|
formsemestre = r.json()
|
2022-05-05 19:50:09 +02:00
|
|
|
assert verify_fields(formsemestre, FSEM_FIELDS)
|
2022-06-27 16:12:41 +02:00
|
|
|
assert isinstance(formsemestre["block_moyennes"], bool)
|
|
|
|
assert isinstance(formsemestre["bul_bgcolor"], str)
|
|
|
|
assert isinstance(formsemestre["bul_hide_xml"], bool)
|
|
|
|
assert isinstance(formsemestre["date_debut_iso"], str)
|
|
|
|
assert isinstance(formsemestre["date_debut"], str)
|
|
|
|
assert isinstance(formsemestre["date_fin_iso"], str)
|
|
|
|
assert isinstance(formsemestre["date_fin"], str)
|
|
|
|
assert isinstance(formsemestre["dept_id"], int)
|
|
|
|
assert formsemestre["elt_annee_apo"] is None or isinstance(
|
|
|
|
formsemestre["elt_annee_apo"], str
|
|
|
|
)
|
|
|
|
assert formsemestre["elt_sem_apo"] is None or isinstance(
|
|
|
|
formsemestre["elt_sem_apo"], str
|
|
|
|
)
|
|
|
|
assert isinstance(formsemestre["ens_can_edit_eval"], bool)
|
|
|
|
assert isinstance(formsemestre["etat"], bool)
|
|
|
|
assert isinstance(formsemestre["formation_id"], int)
|
|
|
|
assert isinstance(formsemestre["formsemestre_id"], int)
|
|
|
|
assert isinstance(formsemestre["gestion_compensation"], bool)
|
|
|
|
assert isinstance(formsemestre["gestion_semestrielle"], bool)
|
|
|
|
assert isinstance(formsemestre["id"], int)
|
|
|
|
assert isinstance(formsemestre["modalite"], str)
|
|
|
|
assert isinstance(formsemestre["resp_can_change_ens"], bool)
|
|
|
|
assert isinstance(formsemestre["resp_can_edit"], bool)
|
|
|
|
assert isinstance(formsemestre["responsables"], list)
|
|
|
|
assert formsemestre["scodoc7_id"] is None or isinstance(
|
|
|
|
formsemestre["scodoc7_id"], int
|
|
|
|
)
|
|
|
|
assert isinstance(formsemestre["semestre_id"], int)
|
|
|
|
assert isinstance(formsemestre["titre_formation"], str)
|
|
|
|
assert isinstance(formsemestre["titre_num"], str)
|
|
|
|
assert isinstance(formsemestre["titre"], str)
|
|
|
|
|
|
|
|
### ERROR ###
|
|
|
|
formsemestre_id_inexistant = 165456165165136513510351
|
|
|
|
r = requests.get(
|
|
|
|
f"{API_URL}/formsemestre/{formsemestre_id_inexistant}",
|
|
|
|
headers=api_headers,
|
|
|
|
verify=CHECK_CERTIFICATE,
|
|
|
|
)
|
|
|
|
assert r.status_code == 404
|
2022-04-20 15:50:02 +02:00
|
|
|
|
2022-04-13 12:39:10 +02:00
|
|
|
|
2022-06-27 16:12:41 +02:00
|
|
|
def test_formsemestre_apo(api_headers):
|
|
|
|
"""
|
|
|
|
Route: /formsemestre/apo/<string:etape_apo>
|
|
|
|
"""
|
|
|
|
etape_apo = "A1"
|
|
|
|
r = requests.get(
|
|
|
|
f"{API_URL}/formsemestre/apo/{etape_apo}",
|
|
|
|
headers=api_headers,
|
|
|
|
verify=CHECK_CERTIFICATE,
|
|
|
|
)
|
|
|
|
assert r.status_code == 200
|
|
|
|
list_formsemestre = r.json()
|
|
|
|
assert isinstance(list_formsemestre, list)
|
|
|
|
|
|
|
|
for formsemestre in list_formsemestre:
|
|
|
|
assert isinstance(formsemestre, dict)
|
|
|
|
assert verify_fields(formsemestre, FSEM_FIELDS)
|
|
|
|
assert isinstance(formsemestre["block_moyennes"], bool)
|
|
|
|
assert isinstance(formsemestre["bul_bgcolor"], str)
|
|
|
|
assert isinstance(formsemestre["bul_hide_xml"], bool)
|
|
|
|
assert isinstance(formsemestre["date_debut_iso"], str)
|
|
|
|
assert isinstance(formsemestre["date_debut"], str)
|
|
|
|
assert isinstance(formsemestre["date_fin_iso"], str)
|
|
|
|
assert isinstance(formsemestre["date_fin"], str)
|
|
|
|
assert isinstance(formsemestre["dept_id"], int)
|
|
|
|
assert formsemestre["elt_annee_apo"] is None or isinstance(
|
|
|
|
formsemestre["elt_annee_apo"], str
|
|
|
|
)
|
|
|
|
assert formsemestre["elt_sem_apo"] is None or isinstance(
|
|
|
|
formsemestre["elt_sem_apo"], str
|
|
|
|
)
|
|
|
|
assert isinstance(formsemestre["ens_can_edit_eval"], bool)
|
|
|
|
assert isinstance(formsemestre["etat"], bool)
|
|
|
|
assert isinstance(formsemestre["formation_id"], int)
|
|
|
|
assert isinstance(formsemestre["formsemestre_id"], int)
|
|
|
|
assert isinstance(formsemestre["gestion_compensation"], bool)
|
|
|
|
assert isinstance(formsemestre["gestion_semestrielle"], bool)
|
|
|
|
assert isinstance(formsemestre["id"], int)
|
|
|
|
assert isinstance(formsemestre["modalite"], str)
|
|
|
|
assert isinstance(formsemestre["resp_can_change_ens"], bool)
|
|
|
|
assert isinstance(formsemestre["resp_can_edit"], bool)
|
|
|
|
assert isinstance(formsemestre["responsables"], list)
|
|
|
|
assert formsemestre["scodoc7_id"] is None or isinstance(
|
|
|
|
formsemestre["scodoc7_id"], int
|
|
|
|
)
|
|
|
|
assert isinstance(formsemestre["semestre_id"], int)
|
|
|
|
assert isinstance(formsemestre["titre_formation"], str)
|
|
|
|
assert isinstance(formsemestre["titre_num"], str)
|
|
|
|
assert isinstance(formsemestre["titre"], str)
|
|
|
|
|
|
|
|
### ERROR ###
|
|
|
|
etape_apo_inexistante = "aoefiaozidaoẑidjnoaiznjd"
|
2022-06-28 16:03:31 +02:00
|
|
|
r_error = requests.get(
|
2022-06-27 16:12:41 +02:00
|
|
|
f"{API_URL}/formsemestre/apo/{etape_apo_inexistante}",
|
|
|
|
headers=api_headers,
|
|
|
|
verify=CHECK_CERTIFICATE,
|
|
|
|
)
|
2022-06-28 16:03:31 +02:00
|
|
|
assert r_error.status_code == 404
|
2022-03-09 16:52:07 +01:00
|
|
|
|
2022-04-13 12:39:10 +02:00
|
|
|
|
2022-05-04 23:11:20 +02:00
|
|
|
def test_bulletins(api_headers):
|
|
|
|
"""
|
2022-06-15 16:03:31 +02:00
|
|
|
Route: /formsemestre/<int:formsemestre_id>/bulletins
|
2022-05-04 23:11:20 +02:00
|
|
|
"""
|
2022-04-27 14:11:06 +02:00
|
|
|
r = requests.get(
|
2022-05-04 23:11:20 +02:00
|
|
|
API_URL + "/formsemestre/1/bulletins",
|
|
|
|
headers=api_headers,
|
2022-04-27 14:11:06 +02:00
|
|
|
verify=CHECK_CERTIFICATE,
|
|
|
|
)
|
|
|
|
assert r.status_code == 200
|
|
|
|
|
|
|
|
|
2022-04-20 15:50:02 +02:00
|
|
|
# # jury
|
|
|
|
# def test_jury():
|
|
|
|
# r = requests.get(
|
2022-05-04 23:11:20 +02:00
|
|
|
# API_URL + "/formsemestre/1/jury",
|
|
|
|
# headers=api_headers,
|
2022-04-20 15:50:02 +02:00
|
|
|
# verify=CHECK_CERTIFICATE,
|
|
|
|
# )
|
|
|
|
# assert r.status_code == 200
|
2022-05-02 16:29:26 +02:00
|
|
|
|
2022-05-05 20:06:49 +02:00
|
|
|
|
2022-06-22 16:26:50 +02:00
|
|
|
def test_formsemestre_etudiants(api_headers):
|
|
|
|
"""
|
|
|
|
Route: /formsemestre/<int:formsemestre_id>/etudiants,
|
|
|
|
/formsemestre/<int:formsemestre_id>/etudiants/demissionnaires,
|
|
|
|
/formsemestre/<int:formsemestre_id>/etudiants/defaillants
|
|
|
|
"""
|
2022-06-28 16:03:31 +02:00
|
|
|
formsemestre_id = 1
|
2022-06-22 16:26:50 +02:00
|
|
|
r = requests.get(
|
2022-06-28 16:03:31 +02:00
|
|
|
f"{API_URL}/formsemestre/{formsemestre_id}/etudiants",
|
2022-06-22 16:26:50 +02:00
|
|
|
headers=api_headers,
|
|
|
|
verify=CHECK_CERTIFICATE,
|
|
|
|
)
|
|
|
|
assert r.status_code == 200
|
|
|
|
formsemestre_etus = r.json()
|
|
|
|
assert isinstance(formsemestre_etus, list)
|
|
|
|
for etu in formsemestre_etus:
|
2022-06-28 16:03:31 +02:00
|
|
|
assert verify_fields(etu, FORMSEMESTRE_ETUS_FIELDS) is True
|
2022-06-22 16:26:50 +02:00
|
|
|
assert isinstance(etu["id"], int)
|
|
|
|
assert isinstance(etu["nip"], str)
|
|
|
|
assert isinstance(etu["ine"], str)
|
|
|
|
assert isinstance(etu["nom"], str)
|
|
|
|
assert etu["nom_usuel"] is None or isinstance(etu["nom_usuel"], str)
|
|
|
|
assert isinstance(etu["prenom"], str)
|
|
|
|
assert isinstance(etu["civilite"], str)
|
|
|
|
assert isinstance(etu["groups"], list)
|
|
|
|
etu_groups = etu["groups"]
|
|
|
|
for group in etu_groups:
|
|
|
|
assert isinstance(group["partition_id"], int)
|
|
|
|
assert isinstance(group["id"], int)
|
|
|
|
assert isinstance(group["formsemestre_id"], int)
|
|
|
|
assert group["partition_name"] is None or isinstance(
|
|
|
|
group["partition_name"], str
|
|
|
|
)
|
|
|
|
assert isinstance(group["numero"], int)
|
|
|
|
assert isinstance(group["bul_show_rank"], bool)
|
|
|
|
assert isinstance(group["show_in_lists"], bool)
|
|
|
|
assert isinstance(group["group_id"], int)
|
|
|
|
assert group["group_name"] is None or isinstance(group["group_name"], int)
|
|
|
|
|
|
|
|
### demissionnaires ###
|
|
|
|
r_demissionnaires = requests.get(
|
2022-06-28 16:03:31 +02:00
|
|
|
f"{API_URL}/formsemestre/{formsemestre_id}/etudiants/demissionnaires",
|
2022-06-22 16:26:50 +02:00
|
|
|
headers=api_headers,
|
|
|
|
verify=CHECK_CERTIFICATE,
|
|
|
|
)
|
|
|
|
assert r_demissionnaires.status_code == 200
|
|
|
|
formsemestre_etus = r_demissionnaires.json()
|
|
|
|
assert isinstance(formsemestre_etus, list)
|
2022-06-28 16:03:31 +02:00
|
|
|
|
2022-06-22 16:26:50 +02:00
|
|
|
for etu in formsemestre_etus:
|
2022-06-28 16:03:31 +02:00
|
|
|
assert verify_fields(etu, FORMSEMESTRE_ETUS_FIELDS) is True
|
2022-06-22 16:26:50 +02:00
|
|
|
assert isinstance(etu["id"], int)
|
|
|
|
assert isinstance(etu["nip"], str)
|
|
|
|
assert isinstance(etu["ine"], str)
|
|
|
|
assert isinstance(etu["nom"], str)
|
|
|
|
assert etu["nom_usuel"] is None or isinstance(etu["nom_usuel"], str)
|
|
|
|
assert isinstance(etu["prenom"], str)
|
|
|
|
assert isinstance(etu["civilite"], str)
|
|
|
|
assert isinstance(etu["groups"], list)
|
|
|
|
etu_groups = etu["groups"]
|
|
|
|
for group in etu_groups:
|
|
|
|
assert isinstance(group["partition_id"], int)
|
|
|
|
assert isinstance(group["id"], int)
|
|
|
|
assert isinstance(group["formsemestre_id"], int)
|
|
|
|
assert group["partition_name"] is None or isinstance(
|
|
|
|
group["partition_name"], str
|
|
|
|
)
|
|
|
|
assert isinstance(group["numero"], int)
|
|
|
|
assert isinstance(group["bul_show_rank"], bool)
|
|
|
|
assert isinstance(group["show_in_lists"], bool)
|
|
|
|
assert isinstance(group["group_id"], int)
|
|
|
|
assert group["group_name"] is None or isinstance(group["group_name"], int)
|
|
|
|
|
|
|
|
### defaillants ###
|
|
|
|
r_defaillants = requests.get(
|
2022-06-28 16:03:31 +02:00
|
|
|
f"{API_URL}/formsemestre/{formsemestre_id}/etudiants/defaillants",
|
2022-06-22 16:26:50 +02:00
|
|
|
headers=api_headers,
|
|
|
|
verify=CHECK_CERTIFICATE,
|
|
|
|
)
|
|
|
|
assert r_defaillants.status_code == 200
|
|
|
|
|
|
|
|
formsemestre_etus = r_defaillants.json()
|
|
|
|
assert isinstance(formsemestre_etus, list)
|
|
|
|
for etu in formsemestre_etus:
|
2022-06-28 16:03:31 +02:00
|
|
|
assert verify_fields(etu, FORMSEMESTRE_ETUS_FIELDS) is True
|
2022-06-22 16:26:50 +02:00
|
|
|
assert isinstance(etu["id"], int)
|
|
|
|
assert isinstance(etu["nip"], str)
|
|
|
|
assert isinstance(etu["ine"], str)
|
|
|
|
assert isinstance(etu["nom"], str)
|
|
|
|
assert etu["nom_usuel"] is None or isinstance(etu["nom_usuel"], str)
|
|
|
|
assert isinstance(etu["prenom"], str)
|
|
|
|
assert isinstance(etu["civilite"], str)
|
|
|
|
assert isinstance(etu["groups"], list)
|
|
|
|
etu_groups = etu["groups"]
|
|
|
|
for group in etu_groups:
|
|
|
|
assert isinstance(group["partition_id"], int)
|
|
|
|
assert isinstance(group["id"], int)
|
|
|
|
assert isinstance(group["formsemestre_id"], int)
|
|
|
|
assert group["partition_name"] is None or isinstance(
|
|
|
|
group["partition_name"], str
|
|
|
|
)
|
|
|
|
assert isinstance(group["numero"], int)
|
|
|
|
assert isinstance(group["bul_show_rank"], bool)
|
|
|
|
assert isinstance(group["show_in_lists"], bool)
|
|
|
|
assert isinstance(group["group_id"], int)
|
|
|
|
assert group["group_name"] is None or isinstance(group["group_name"], int)
|
|
|
|
|
2022-06-28 16:03:31 +02:00
|
|
|
assert r.json() != r_demissionnaires.json()
|
|
|
|
assert r.json() != r_defaillants.json()
|
|
|
|
assert r_demissionnaires.json() != r_defaillants.json()
|
2022-06-22 16:26:50 +02:00
|
|
|
|
|
|
|
### ERROR ###
|
|
|
|
id_formsemestre_inexistant = 265165689619851621685
|
|
|
|
r_error = requests.get(
|
|
|
|
f"{API_URL}/formsemestre/{id_formsemestre_inexistant}/etudiants",
|
|
|
|
headers=api_headers,
|
|
|
|
verify=CHECK_CERTIFICATE,
|
|
|
|
)
|
|
|
|
assert r_error.status_code == 404
|
|
|
|
|
|
|
|
r_error_demissionnaires = requests.get(
|
|
|
|
f"{API_URL}/formsemestre/{id_formsemestre_inexistant}/etudiants/demissionnaires",
|
|
|
|
headers=api_headers,
|
|
|
|
verify=CHECK_CERTIFICATE,
|
|
|
|
)
|
|
|
|
assert r_error_demissionnaires.status_code == 404
|
|
|
|
|
|
|
|
r_error_defaillants = requests.get(
|
|
|
|
f"{API_URL}/formsemestre/{id_formsemestre_inexistant}/etudiants/defaillants",
|
|
|
|
headers=api_headers,
|
|
|
|
verify=CHECK_CERTIFICATE,
|
|
|
|
)
|
|
|
|
assert r_error_defaillants.status_code == 404
|
2022-06-15 16:03:31 +02:00
|
|
|
|
|
|
|
|
2022-05-05 20:06:49 +02:00
|
|
|
def test_formsemestre_programme(api_headers):
|
2022-05-04 23:11:20 +02:00
|
|
|
"""
|
2022-05-05 20:06:49 +02:00
|
|
|
Route: /formsemestre/1/programme
|
2022-05-04 23:11:20 +02:00
|
|
|
"""
|
2022-05-02 16:29:26 +02:00
|
|
|
|
|
|
|
r = requests.get(
|
2022-05-04 23:11:20 +02:00
|
|
|
API_URL + "/formsemestre/1/programme",
|
|
|
|
headers=api_headers,
|
2022-05-02 16:29:26 +02:00
|
|
|
verify=CHECK_CERTIFICATE,
|
|
|
|
)
|
|
|
|
assert r.status_code == 200
|
2022-05-05 20:06:49 +02:00
|
|
|
prog = r.json()
|
|
|
|
assert isinstance(prog, dict)
|
|
|
|
assert "ues" in prog
|
|
|
|
assert "modules" in prog
|
|
|
|
assert "ressources" in prog
|
|
|
|
assert "saes" in prog
|
|
|
|
assert isinstance(prog["ues"], list)
|
|
|
|
assert isinstance(prog["modules"], list)
|
|
|
|
ue = prog["ues"][0]
|
|
|
|
modules = prog["modules"]
|
|
|
|
# Il y a toujours au moins une SAE et une ressources dans notre base de test
|
|
|
|
ressource = prog["ressources"][0]
|
|
|
|
sae = prog["saes"][0]
|
|
|
|
|
|
|
|
assert verify_fields(ue, UE_FIELDS)
|
|
|
|
if len(modules) > 1:
|
|
|
|
assert verify_fields(modules[0], MODIMPL_FIELDS)
|
|
|
|
assert verify_fields(ressource, MODIMPL_FIELDS)
|
|
|
|
assert verify_fields(sae, MODIMPL_FIELDS)
|
2022-06-02 16:18:47 +02:00
|
|
|
|
|
|
|
|
2022-06-10 16:35:28 +02:00
|
|
|
def test_etat_evals(
|
|
|
|
api_headers,
|
2022-06-13 16:27:30 +02:00
|
|
|
):
|
2022-06-02 16:18:47 +02:00
|
|
|
"""
|
|
|
|
Route : /formsemestre/<int:formsemestre_id>/etat_evals
|
|
|
|
"""
|
|
|
|
r = requests.get(
|
|
|
|
API_URL + "/formsemestre/1/etat_evals",
|
|
|
|
headers=api_headers,
|
|
|
|
verify=CHECK_CERTIFICATE,
|
|
|
|
)
|
|
|
|
assert r.status_code == 200
|
2022-06-10 16:35:28 +02:00
|
|
|
|
|
|
|
etat_evals = r.json()
|
|
|
|
|
|
|
|
assert len(etat_evals) == 3
|
|
|
|
|
2022-06-13 16:27:30 +02:00
|
|
|
for ue in etat_evals.values():
|
|
|
|
for module in ue:
|
|
|
|
assert isinstance(module["id"], int)
|
|
|
|
assert isinstance(module["titre"], str)
|
|
|
|
assert isinstance(module["evaluations"], list)
|
|
|
|
|
|
|
|
for eval in module["evaluations"]:
|
|
|
|
assert verify_fields(eval, EVAL_FIELDS)
|
|
|
|
assert isinstance(eval["id"], int)
|
|
|
|
assert eval["description"] is None or isinstance(
|
|
|
|
eval["description"], str
|
|
|
|
)
|
|
|
|
assert eval["datetime_epreuve"] is None or isinstance(
|
|
|
|
eval["datetime_epreuve"], str
|
|
|
|
)
|
|
|
|
assert isinstance(eval["heure_fin"], str)
|
|
|
|
assert isinstance(eval["coefficient"], float)
|
|
|
|
assert isinstance(eval["comptee"], str)
|
|
|
|
assert isinstance(eval["inscrits"], int)
|
|
|
|
assert isinstance(eval["manquantes"], int)
|
|
|
|
assert isinstance(eval["ABS"], int)
|
|
|
|
assert isinstance(eval["ATT"], int)
|
|
|
|
assert isinstance(eval["EXC"], int)
|
|
|
|
assert isinstance(eval["saisie_notes"], dict)
|
|
|
|
|
|
|
|
list_eval_id = [e["id"] for e in module["evaluations"]]
|
|
|
|
all_unique = True
|
|
|
|
for id in list_eval_id:
|
|
|
|
if list_eval_id.count(id) > 1:
|
|
|
|
all_unique = False
|
|
|
|
assert all_unique is True
|
|
|
|
|
|
|
|
saisie_notes = eval["saisie_notes"]
|
|
|
|
assert verify_fields(saisie_notes, SAISIE_NOTES_FIELDS)
|
|
|
|
assert eval["saisie_notes"]["datetime_debut"] is None or isinstance(
|
|
|
|
eval["saisie_notes"]["datetime_debut"], str
|
|
|
|
)
|
|
|
|
assert eval["saisie_notes"]["datetime_debut"] is None or isinstance(
|
|
|
|
eval["saisie_notes"]["datetime_fin"], str
|
|
|
|
)
|
|
|
|
assert eval["saisie_notes"]["datetime_debut"] is None or isinstance(
|
|
|
|
eval["saisie_notes"]["datetime_mediane"], str
|
|
|
|
)
|
|
|
|
|
|
|
|
if (
|
|
|
|
eval["saisie_notes"]["datetime_fin"] is not None
|
|
|
|
and eval["saisie_notes"]["datetime_mediane"] is not None
|
|
|
|
and eval["saisie_notes"]["datetime_debut"] is not None
|
|
|
|
):
|
|
|
|
assert (
|
|
|
|
eval["saisie_notes"]["datetime_fin"]
|
|
|
|
> eval["saisie_notes"]["datetime_mediane"]
|
|
|
|
)
|
|
|
|
assert (
|
|
|
|
eval["saisie_notes"]["datetime_fin"]
|
|
|
|
> eval["saisie_notes"]["datetime_debut"]
|
|
|
|
)
|
|
|
|
assert (
|
|
|
|
eval["saisie_notes"]["datetime_mediane"]
|
|
|
|
> eval["saisie_notes"]["datetime_debut"]
|
|
|
|
)
|
|
|
|
|
|
|
|
list_id_ue1 = []
|
|
|
|
list_titre_ue1 = []
|
|
|
|
|
|
|
|
list_id_ue2 = []
|
|
|
|
list_titre_ue2 = []
|
|
|
|
|
|
|
|
list_id_ue3 = []
|
|
|
|
list_titre_ue3 = []
|
|
|
|
i = 0
|
|
|
|
for ue in etat_evals.values():
|
|
|
|
i += 1
|
|
|
|
for module in ue:
|
|
|
|
if i == 1:
|
|
|
|
list_id_ue1.append(module["id"])
|
|
|
|
list_titre_ue1.append(module["id"])
|
|
|
|
elif i == 2:
|
|
|
|
list_id_ue2.append(module["id"])
|
|
|
|
list_titre_ue2.append(module["id"])
|
|
|
|
elif i == 3:
|
|
|
|
list_id_ue3.append(module["id"])
|
|
|
|
list_titre_ue3.append(module["id"])
|
|
|
|
|
|
|
|
assert list_id_ue1 != list_id_ue2
|
|
|
|
assert list_id_ue1 != list_titre_ue3
|
|
|
|
assert list_id_ue2 != list_titre_ue3
|
|
|
|
|
|
|
|
assert list_titre_ue1 != list_titre_ue2
|
|
|
|
assert list_titre_ue1 != list_titre_ue3
|
|
|
|
assert list_titre_ue2 != list_titre_ue3
|
2022-06-10 16:35:28 +02:00
|
|
|
|
|
|
|
##### ERROR #####
|
|
|
|
fake_eval_id = 153165161656849846516511321651651
|
|
|
|
r = requests.get(
|
|
|
|
f"{API_URL}/formsemestre/{fake_eval_id}/etat_evals",
|
|
|
|
headers=api_headers,
|
|
|
|
verify=CHECK_CERTIFICATE,
|
|
|
|
)
|
|
|
|
assert r.status_code == 404
|