forked from ScoDoc/ScoDoc
Compare commits
No commits in common. "a1e5c3afabaa27b70ab1c957a758ab0c8b19c11f" and "938090bd32e4dd16bd082cc67efb1ff9b67e796a" have entirely different histories.
a1e5c3afab
...
938090bd32
@ -20,11 +20,6 @@ Utilisation :
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from tests.api.setup_test_api import API_URL, CHECK_CERTIFICATE, api_headers
|
from tests.api.setup_test_api import API_URL, CHECK_CERTIFICATE, api_headers
|
||||||
from tests.api.tools_test_api import (
|
|
||||||
verify_fields,
|
|
||||||
EVALUATIONS_FIELDS,
|
|
||||||
EVALUATION_FIELDS,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_evaluations(api_headers):
|
def test_evaluations(api_headers):
|
||||||
@ -34,65 +29,27 @@ def test_evaluations(api_headers):
|
|||||||
Route :
|
Route :
|
||||||
- /evaluations/<int:moduleimpl_id>
|
- /evaluations/<int:moduleimpl_id>
|
||||||
"""
|
"""
|
||||||
moduleimpl_id = 1
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
f"{API_URL}/evaluations/{moduleimpl_id}",
|
API_URL + "/evaluations/1",
|
||||||
headers=api_headers,
|
headers=api_headers,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
list_eval = r.json()
|
# TODO
|
||||||
assert isinstance(list_eval, list)
|
|
||||||
for eval in list_eval:
|
|
||||||
assert verify_fields(eval, EVALUATIONS_FIELDS) is True
|
|
||||||
assert isinstance(eval["id"], int)
|
|
||||||
assert isinstance(eval["jour"], str)
|
|
||||||
assert isinstance(eval["heure_fin"], str)
|
|
||||||
assert isinstance(eval["note_max"], float)
|
|
||||||
assert isinstance(eval["visibulletin"], bool)
|
|
||||||
assert isinstance(eval["evaluation_type"], int)
|
|
||||||
assert isinstance(eval["moduleimpl_id"], int)
|
|
||||||
assert isinstance(eval["heure_debut"], str)
|
|
||||||
assert eval["description"] is None or isinstance(eval["description"], str)
|
|
||||||
assert isinstance(eval["coefficient"], float)
|
|
||||||
assert isinstance(eval["publish_incomplete"], bool)
|
|
||||||
assert isinstance(eval["numero"], int)
|
|
||||||
assert isinstance(eval["evaluation_id"], int)
|
|
||||||
assert eval["date_debut"] is None or isinstance(eval["date_debut"], str)
|
|
||||||
assert eval["date_fin"] is None or isinstance(eval["date_fin"], str)
|
|
||||||
assert isinstance(eval["poids"], dict)
|
|
||||||
assert eval["jouriso"] is None or isinstance(eval["jouriso"], str)
|
|
||||||
assert isinstance(eval["duree"], str)
|
|
||||||
assert isinstance(eval["descrheure"], str)
|
|
||||||
assert isinstance(eval["matin"], int)
|
|
||||||
assert isinstance(eval["apresmidi"], int)
|
|
||||||
|
|
||||||
assert eval["moduleimpl_id"] == moduleimpl_id
|
|
||||||
|
|
||||||
|
|
||||||
def test_evaluation_notes(api_headers):
|
# TODO car pas d'évaluations créées à ce stade
|
||||||
"""
|
# def test_evaluation_notes(api_headers):
|
||||||
Test 'evaluation_notes'
|
# """
|
||||||
|
# Test 'evaluation_notes'
|
||||||
Route :
|
#
|
||||||
- /evaluation/eval_notes/<int:evaluation_id>
|
# Route :
|
||||||
"""
|
# - /evaluation/eval_notes/<int:evaluation_id>
|
||||||
eval_id = 1
|
# """
|
||||||
r = requests.get(
|
# r = requests.get(
|
||||||
f"{API_URL}/evaluation/eval_notes/{eval_id}",
|
# API_URL + "/evaluation/eval_notes/1",
|
||||||
headers=api_headers,
|
# headers=api_headers,
|
||||||
verify=CHECK_CERTIFICATE,
|
# verify=CHECK_CERTIFICATE,
|
||||||
)
|
# )
|
||||||
assert r.status_code == 200
|
# assert r.status_code == 200
|
||||||
eval_notes = r.json()
|
# # TODO
|
||||||
for i in range(1, len(eval_notes)):
|
|
||||||
assert verify_fields(eval_notes[f"{i}"], EVALUATION_FIELDS)
|
|
||||||
assert isinstance(eval_notes[f"{i}"]["id"], int)
|
|
||||||
assert isinstance(eval_notes[f"{i}"]["etudid"], int)
|
|
||||||
assert isinstance(eval_notes[f"{i}"]["evaluation_id"], int)
|
|
||||||
assert isinstance(eval_notes[f"{i}"]["value"], float)
|
|
||||||
assert isinstance(eval_notes[f"{i}"]["comment"], str)
|
|
||||||
assert isinstance(eval_notes[f"{i}"]["date"], str)
|
|
||||||
assert isinstance(eval_notes[f"{i}"]["uid"], int)
|
|
||||||
|
|
||||||
assert eval_id == eval_notes[f"{i}"]["evaluation_id"]
|
|
||||||
|
@ -20,11 +20,7 @@ Utilisation :
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from tests.api.setup_test_api import API_URL, CHECK_CERTIFICATE, api_headers
|
from tests.api.setup_test_api import API_URL, CHECK_CERTIFICATE, api_headers
|
||||||
from tests.api.tools_test_api import (
|
from tests.api.tools_test_api import verify_fields
|
||||||
verify_fields,
|
|
||||||
PARTITIONS_FIELDS,
|
|
||||||
PARTITIONS_GROUPS_ETU_FIELDS,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_partition(api_headers):
|
def test_partition(api_headers):
|
||||||
@ -34,30 +30,27 @@ def test_partition(api_headers):
|
|||||||
Route :
|
Route :
|
||||||
- /partitions/<int:formsemestre_id>
|
- /partitions/<int:formsemestre_id>
|
||||||
"""
|
"""
|
||||||
partition_id = 1
|
fields = [
|
||||||
|
"partition_id",
|
||||||
|
"id",
|
||||||
|
"formsemestre_id",
|
||||||
|
"partition_name",
|
||||||
|
"numero",
|
||||||
|
"bul_show_rank",
|
||||||
|
"show_in_lists",
|
||||||
|
]
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
f"{API_URL}/partitions/{partition_id}",
|
API_URL + "/partitions/1",
|
||||||
headers=api_headers,
|
headers=api_headers,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
partitions = r.json()
|
partitions = r.json()
|
||||||
assert len(partitions) == 1
|
assert len(partitions) == 1
|
||||||
assert isinstance(partitions, list)
|
|
||||||
partition = partitions[0]
|
partition = partitions[0]
|
||||||
assert isinstance(partition, dict)
|
fields_ok = verify_fields(partition, fields)
|
||||||
assert verify_fields(partition, PARTITIONS_FIELDS) is True
|
assert fields_ok is True
|
||||||
assert partition_id == partition["partition_id"]
|
|
||||||
|
|
||||||
assert isinstance(partition["partition_id"], int)
|
|
||||||
assert isinstance(partition["id"], int)
|
|
||||||
assert isinstance(partition["formsemestre_id"], int)
|
|
||||||
assert partition["partition_name"] is None or isinstance(
|
|
||||||
partition["partition_name"], str
|
|
||||||
)
|
|
||||||
assert isinstance(partition["numero"], int)
|
|
||||||
assert isinstance(partition["bul_show_rank"], bool)
|
|
||||||
assert isinstance(partition["show_in_lists"], bool)
|
|
||||||
|
|
||||||
|
|
||||||
def test_etud_in_group(api_headers):
|
def test_etud_in_group(api_headers):
|
||||||
@ -65,109 +58,66 @@ def test_etud_in_group(api_headers):
|
|||||||
Test 'etud_in_group'
|
Test 'etud_in_group'
|
||||||
|
|
||||||
Routes :
|
Routes :
|
||||||
- /partition/group/<int:group_id>
|
- /partitions/groups/<int:group_id>
|
||||||
- /partition/group/<int:group_id>/etat/<string:etat>
|
- /partitions/groups/<int:group_id>/etat/<string:etat>
|
||||||
"""
|
"""
|
||||||
group_id = 1
|
fields = [
|
||||||
|
"etudid",
|
||||||
|
"id",
|
||||||
|
"dept_id",
|
||||||
|
"nom",
|
||||||
|
"prenom",
|
||||||
|
"nom_usuel",
|
||||||
|
"civilite",
|
||||||
|
"date_naissance",
|
||||||
|
"lieu_naissance",
|
||||||
|
"dept_naissance",
|
||||||
|
"nationalite",
|
||||||
|
"statut",
|
||||||
|
"boursier",
|
||||||
|
"photo_filename",
|
||||||
|
"code_nip",
|
||||||
|
"code_ine",
|
||||||
|
"scodoc7_id",
|
||||||
|
"email",
|
||||||
|
"emailperso",
|
||||||
|
"domicile",
|
||||||
|
"codepostaldomicile",
|
||||||
|
"villedomicile",
|
||||||
|
"paysdomicile",
|
||||||
|
"telephone",
|
||||||
|
"telephonemobile",
|
||||||
|
"fax",
|
||||||
|
"typeadresse",
|
||||||
|
"description",
|
||||||
|
"group_id",
|
||||||
|
"etat",
|
||||||
|
"civilite_str",
|
||||||
|
"nom_disp",
|
||||||
|
"nomprenom",
|
||||||
|
"ne",
|
||||||
|
"email_default",
|
||||||
|
]
|
||||||
|
|
||||||
r = requests.get(
|
r = requests.get(
|
||||||
f"{API_URL}/partition/group/{group_id}",
|
API_URL + "/partitions/groups/1",
|
||||||
headers=api_headers,
|
headers=api_headers,
|
||||||
verify=CHECK_CERTIFICATE,
|
verify=CHECK_CERTIFICATE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
etu = r.json()[0]
|
||||||
|
|
||||||
|
fields_ok = verify_fields(etu, fields)
|
||||||
|
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert isinstance(r.json(), list)
|
assert len(r.json()) == 16
|
||||||
|
assert fields_ok is True
|
||||||
for etu in r.json():
|
# r = requests.get(
|
||||||
assert verify_fields(etu, PARTITIONS_GROUPS_ETU_FIELDS)
|
# API_URL + "/partitions/groups/1/etat/<string:etat>",
|
||||||
assert isinstance(etu["etudid"], int)
|
# headers=api_headers,
|
||||||
assert isinstance(etu["id"], int)
|
# verify=CHECK_CERTIFICATE,
|
||||||
assert isinstance(etu["dept_id"], int)
|
# )
|
||||||
assert isinstance(etu["nom"], str)
|
# assert r.status_code == 200
|
||||||
assert isinstance(etu["prenom"], str)
|
|
||||||
assert isinstance(etu["nom_usuel"], str)
|
|
||||||
assert isinstance(etu["civilite"], str)
|
|
||||||
assert etu["date_naissance"] is None or isinstance(etu["date_naissance"], str)
|
|
||||||
assert etu["lieu_naissance"] is None or isinstance(etu["lieu_naissance"], str)
|
|
||||||
assert etu["dept_naissance"] is None or isinstance(etu["dept_naissance"], str)
|
|
||||||
assert etu["nationalite"] is None or isinstance(etu["nationalite"], str)
|
|
||||||
assert etu["statut"] is None or isinstance(etu["statut"], str)
|
|
||||||
assert etu["boursier"] is None or isinstance(etu["boursier"], bool)
|
|
||||||
assert etu["photo_filename"] is None or isinstance(etu["photo_filename"], str)
|
|
||||||
assert isinstance(etu["code_nip"], str)
|
|
||||||
assert isinstance(etu["code_ine"], str)
|
|
||||||
assert etu["scodoc7_id"] is None or isinstance(etu["scodoc7_id"], int)
|
|
||||||
assert isinstance(etu["email"], str)
|
|
||||||
assert etu["emailperso"] is None or isinstance(etu["emailperso"], str)
|
|
||||||
assert etu["domicile"] is None or isinstance(etu["domicile"], str)
|
|
||||||
assert etu["codepostaldomicile"] is None or isinstance(
|
|
||||||
etu["codepostaldomicile"], str
|
|
||||||
)
|
|
||||||
assert etu["villedomicile"] is None or isinstance(etu["villedomicile"], str)
|
|
||||||
assert etu["paysdomicile"] is None or isinstance(etu["paysdomicile"], str)
|
|
||||||
assert etu["telephone"] is None or isinstance(etu["telephone"], str)
|
|
||||||
assert etu["telephonemobile"] is None or isinstance(etu["telephonemobile"], str)
|
|
||||||
assert etu["fax"] is None or isinstance(etu["fax"], str)
|
|
||||||
assert isinstance(etu["typeadresse"], str)
|
|
||||||
assert etu["description"] is None or isinstance(etu["description"], int)
|
|
||||||
assert isinstance(etu["group_id"], int)
|
|
||||||
assert isinstance(etu["etat"], str)
|
|
||||||
assert isinstance(etu["civilite_str"], str)
|
|
||||||
assert isinstance(etu["nom_disp"], str)
|
|
||||||
assert isinstance(etu["nomprenom"], str)
|
|
||||||
assert isinstance(etu["ne"], str)
|
|
||||||
assert isinstance(etu["email_default"], str)
|
|
||||||
|
|
||||||
etat = "I"
|
|
||||||
r_etat = requests.get(
|
|
||||||
f"{API_URL}/partition/group/{group_id}/etat/{etat}",
|
|
||||||
headers=api_headers,
|
|
||||||
verify=CHECK_CERTIFICATE,
|
|
||||||
)
|
|
||||||
assert r_etat.status_code == 200
|
|
||||||
|
|
||||||
assert isinstance(r_etat.json(), list)
|
|
||||||
|
|
||||||
for etu in r_etat.json():
|
|
||||||
assert verify_fields(etu, PARTITIONS_GROUPS_ETU_FIELDS)
|
|
||||||
assert isinstance(etu["etudid"], int)
|
|
||||||
assert isinstance(etu["id"], int)
|
|
||||||
assert isinstance(etu["dept_id"], int)
|
|
||||||
assert isinstance(etu["nom"], str)
|
|
||||||
assert isinstance(etu["prenom"], str)
|
|
||||||
assert isinstance(etu["nom_usuel"], str)
|
|
||||||
assert isinstance(etu["civilite"], str)
|
|
||||||
assert etu["date_naissance"] is None or isinstance(etu["date_naissance"], str)
|
|
||||||
assert etu["lieu_naissance"] is None or isinstance(etu["lieu_naissance"], str)
|
|
||||||
assert etu["dept_naissance"] is None or isinstance(etu["dept_naissance"], str)
|
|
||||||
assert etu["nationalite"] is None or isinstance(etu["nationalite"], str)
|
|
||||||
assert etu["statut"] is None or isinstance(etu["statut"], str)
|
|
||||||
assert etu["boursier"] is None or isinstance(etu["boursier"], bool)
|
|
||||||
assert etu["photo_filename"] is None or isinstance(etu["photo_filename"], str)
|
|
||||||
assert isinstance(etu["code_nip"], str)
|
|
||||||
assert isinstance(etu["code_ine"], str)
|
|
||||||
assert etu["scodoc7_id"] is None or isinstance(etu["scodoc7_id"], int)
|
|
||||||
assert isinstance(etu["email"], str)
|
|
||||||
assert etu["emailperso"] is None or isinstance(etu["emailperso"], str)
|
|
||||||
assert etu["domicile"] is None or isinstance(etu["domicile"], str)
|
|
||||||
assert etu["codepostaldomicile"] is None or isinstance(
|
|
||||||
etu["codepostaldomicile"], str
|
|
||||||
)
|
|
||||||
assert etu["villedomicile"] is None or isinstance(etu["villedomicile"], str)
|
|
||||||
assert etu["paysdomicile"] is None or isinstance(etu["paysdomicile"], str)
|
|
||||||
assert etu["telephone"] is None or isinstance(etu["telephone"], str)
|
|
||||||
assert etu["telephonemobile"] is None or isinstance(etu["telephonemobile"], str)
|
|
||||||
assert etu["fax"] is None or isinstance(etu["fax"], str)
|
|
||||||
assert isinstance(etu["typeadresse"], str)
|
|
||||||
assert etu["description"] is None or isinstance(etu["description"], int)
|
|
||||||
assert isinstance(etu["group_id"], int)
|
|
||||||
assert isinstance(etu["etat"], str)
|
|
||||||
assert isinstance(etu["civilite_str"], str)
|
|
||||||
assert isinstance(etu["nom_disp"], str)
|
|
||||||
assert isinstance(etu["nomprenom"], str)
|
|
||||||
assert isinstance(etu["ne"], str)
|
|
||||||
assert isinstance(etu["email_default"], str)
|
|
||||||
|
|
||||||
assert etat == etu["etat"]
|
|
||||||
|
|
||||||
|
|
||||||
# # set_groups
|
# # set_groups
|
||||||
|
@ -558,86 +558,3 @@ FORMSEMESTRE_ETUS_GROUPS_FIELDS = {
|
|||||||
"group_id",
|
"group_id",
|
||||||
"group_name",
|
"group_name",
|
||||||
}
|
}
|
||||||
|
|
||||||
EVALUATIONS_FIELDS = {
|
|
||||||
"id",
|
|
||||||
"jour",
|
|
||||||
"heure_fin",
|
|
||||||
"note_max",
|
|
||||||
"visibulletin",
|
|
||||||
"evaluation_type",
|
|
||||||
"moduleimpl_id",
|
|
||||||
"heure_debut",
|
|
||||||
"description",
|
|
||||||
"coefficient",
|
|
||||||
"publish_incomplete",
|
|
||||||
"numero",
|
|
||||||
"evaluation_id",
|
|
||||||
"date_debut",
|
|
||||||
"date_fin",
|
|
||||||
"poids",
|
|
||||||
"jouriso",
|
|
||||||
"duree",
|
|
||||||
"descrheure",
|
|
||||||
"matin",
|
|
||||||
"apresmidi",
|
|
||||||
}
|
|
||||||
|
|
||||||
EVALUATION_FIELDS = {
|
|
||||||
"id",
|
|
||||||
"etudid",
|
|
||||||
"evaluation_id",
|
|
||||||
"value",
|
|
||||||
"comment",
|
|
||||||
"date",
|
|
||||||
"uid",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PARTITIONS_FIELDS = {
|
|
||||||
"partition_id",
|
|
||||||
"id",
|
|
||||||
"formsemestre_id",
|
|
||||||
"partition_name",
|
|
||||||
"numero",
|
|
||||||
"bul_show_rank",
|
|
||||||
"show_in_lists",
|
|
||||||
}
|
|
||||||
|
|
||||||
PARTITIONS_GROUPS_ETU_FIELDS = {
|
|
||||||
"etudid",
|
|
||||||
"id",
|
|
||||||
"dept_id",
|
|
||||||
"nom",
|
|
||||||
"prenom",
|
|
||||||
"nom_usuel",
|
|
||||||
"civilite",
|
|
||||||
"date_naissance",
|
|
||||||
"lieu_naissance",
|
|
||||||
"dept_naissance",
|
|
||||||
"nationalite",
|
|
||||||
"statut",
|
|
||||||
"boursier",
|
|
||||||
"photo_filename",
|
|
||||||
"code_nip",
|
|
||||||
"code_ine",
|
|
||||||
"scodoc7_id",
|
|
||||||
"email",
|
|
||||||
"emailperso",
|
|
||||||
"domicile",
|
|
||||||
"codepostaldomicile",
|
|
||||||
"villedomicile",
|
|
||||||
"paysdomicile",
|
|
||||||
"telephone",
|
|
||||||
"telephonemobile",
|
|
||||||
"fax",
|
|
||||||
"typeadresse",
|
|
||||||
"description",
|
|
||||||
"group_id",
|
|
||||||
"etat",
|
|
||||||
"civilite_str",
|
|
||||||
"nom_disp",
|
|
||||||
"nomprenom",
|
|
||||||
"ne",
|
|
||||||
"email_default",
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user