ajout des docstring des fonctions de test

This commit is contained in:
leonard_montalbano 2022-05-06 16:05:34 +02:00
parent 6ba603f92a
commit 864d90e22c
9 changed files with 170 additions and 124 deletions

View File

@ -28,7 +28,12 @@ NIP = "1"
# absences # absences
def test_absences(api_headers): def test_absences(api_headers):
""" """
Route: /absences/etudid/<int:etudid> Test 'absences'
Routes :
- /absences/etudid/<int:etudid>
- /absences/nip/<int:nip>
- /absences/ine/<int:ine>
""" """
r = requests.get( r = requests.get(
f"{API_URL}/absences/etudid/{ETUDID}", f"{API_URL}/absences/etudid/{ETUDID}",
@ -55,7 +60,12 @@ def test_absences(api_headers):
# absences_justify # absences_justify
def test_absences_justify(api_headers): def test_absences_justify(api_headers):
""" """
Route: /absences/etudid/<etudid:int>/just Test 'absences_just'
Routes :
- /absences/etudid/<int:etudid>/just
- /absences/nip/<int:nip>/just
- /absences/ine/<int:ine>/just
""" """
r = requests.get( r = requests.get(
API_URL + f"/absences/etudid/{ETUDID}/just", API_URL + f"/absences/etudid/{ETUDID}/just",
@ -85,10 +95,15 @@ def test_absences_justify(api_headers):
# XXX TODO # XXX TODO
# def test_abs_groupe_etat(api_headers): # def test_abs_groupe_etat(api_headers):
# """ # """
# Route: # Test 'abs_groupe_etat'
#
# Routes :
# - /absences/abs_group_etat/<int:group_id>
# - /absences/abs_group_etat/group_id/<int:group_id>/date_debut/<string:date_debut>/date_fin/<string:date_fin>
# """ # """
# r = requests.get( # r = requests.get(
# API_URL + "/absences/abs_group_etat/?group_id=<int:group_id>&date_debut=date_debut&date_fin=date_fin", # API_URL + "/absences/abs_group_etat/group_id/<int:group_id>/date_debut/<string:date_debut>/"
# "date_fin/<string:date_fin>",
# headers=api_headers, # headers=api_headers,
# verify=CHECK_CERTIFICATE, # verify=CHECK_CERTIFICATE,
# ) # )

View File

@ -24,7 +24,13 @@ from tests.api.tools_test_api import verify_fields
def test_departements(api_headers): def test_departements(api_headers):
"check liste de sdépartements" """
Test 'departements'
Route :
- /departements
"""
fields = [ fields = [
"id", "id",
"acronym", "acronym",
@ -49,6 +55,13 @@ def test_departements(api_headers):
def test_list_etudiants(api_headers): def test_list_etudiants(api_headers):
"""
Test 'list_etudiants'
Routes :
- /departements/<string:dept>/etudiants/list
- /departements/<string:dept>/etudiants/list/<int:formsemestre_id>
"""
fields = { fields = {
"civilite", "civilite",
"code_ine", "code_ine",
@ -107,6 +120,12 @@ def test_list_etudiants(api_headers):
# liste_semestres_courant # liste_semestres_courant
def test_semestres_courant(api_headers): def test_semestres_courant(api_headers):
"""
Test 'liste_semestres_courant'
Route :
- /departements/<string:dept>/semestres_courants
"""
fields = [ fields = [
"titre", "titre",
"gestion_semestrielle", "gestion_semestrielle",
@ -133,6 +152,7 @@ def test_semestres_courant(api_headers):
"date_debut_iso", "date_debut_iso",
"date_fin_iso", "date_fin_iso",
"responsables", "responsables",
"titre_court",
] ]
r = requests.get( r = requests.get(

View File

@ -26,7 +26,11 @@ from tests.api.tools_test_api import verify_fields
# etudiants_courant # etudiants_courant
def test_etudiants_courant(api_headers): def test_etudiants_courant(api_headers):
""" """
Route: /etudiants/courant Test 'etudiants_courant'
Routes :
- /etudiants/courant
- /etudiants/courant/long
""" """
fields = [ fields = [
"id", "id",
@ -98,7 +102,12 @@ def test_etudiants_courant(api_headers):
def test_etudiant(api_headers): def test_etudiant(api_headers):
""" """
Route: Test 'etudiant'
Routes :
- /etudiant/etudid/<int:etudid>
- /etudiant/nip/<int:nip>
- /etudiant/ine/<int:ine>
""" """
fields = [ fields = [
"civilite", "civilite",
@ -169,7 +178,12 @@ def test_etudiant(api_headers):
def test_etudiant_formsemestres(api_headers): def test_etudiant_formsemestres(api_headers):
""" """
Route: /etudiant/etudid/<etudid:int>/formsemestres Test 'etudiant_formsemestres'
Routes :
- /etudiant/etudid/<int:etudid>/formsemestres
- /etudiant/nip/<int:nip>/formsemestres
- /etudiant/ine/<int:ine>/formsemestres
""" """
fields = [ fields = [
"date_fin", "date_fin",
@ -197,6 +211,7 @@ def test_etudiant_formsemestres(api_headers):
"date_debut_iso", "date_debut_iso",
"date_fin_iso", "date_fin_iso",
"responsables", "responsables",
"titre_court",
] ]
######### Test etudid ######### ######### Test etudid #########
@ -248,7 +263,21 @@ def test_etudiant_formsemestres(api_headers):
def test_etudiant_bulletin_semestre(api_headers): def test_etudiant_bulletin_semestre(api_headers):
""" """
Route: /etudiant/etudid/<etudid>/formsemestre/<formsemestre_id>/bulletin Test 'etudiant_bulletin_semestre'
Routes :
- /etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin
- /etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin
- /etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin
- /etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin/pdf
- /etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin/pdf
- /etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin/pdf
- /etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin/short
- /etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin/short
- /etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin/short
- /etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin/short/pdf
- /etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin/short/pdf
- /etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin/short/pdf
""" """
######### Test etudid ######### ######### Test etudid #########
@ -285,8 +314,12 @@ def test_etudiant_bulletin_semestre(api_headers):
def test_etudiant_groups(api_headers): def test_etudiant_groups(api_headers):
""" """
Route: Test 'etudiant_groups'
/etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/groups
Routes :
- /etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/groups
- /etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/groups
- /etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/groups
""" """
fields = [ fields = [
"partition_id", "partition_id",

View File

@ -24,7 +24,10 @@ from tests.api.setup_test_api import API_URL, CHECK_CERTIFICATE, api_headers
def test_evaluations(api_headers): def test_evaluations(api_headers):
""" """
Route: /evaluation/<int:moduleimpl_id> Test 'evaluations'
Route :
- /evaluations/<int:moduleimpl_id>
""" """
r = requests.get( r = requests.get(
API_URL + "/evaluations/1", API_URL + "/evaluations/1",
@ -38,7 +41,10 @@ def test_evaluations(api_headers):
# TODO car pas d'évaluations créées à ce stade # TODO car pas d'évaluations créées à ce stade
# def test_evaluation_notes(api_headers): # def test_evaluation_notes(api_headers):
# """ # """
# Route: /evaluation/eval_notes/<int:evaluation_id> # Test 'evaluation_notes'
#
# Route :
# - /evaluation/eval_notes/<int:evaluation_id>
# """ # """
# r = requests.get( # r = requests.get(
# API_URL + "/evaluation/eval_notes/1", # API_URL + "/evaluation/eval_notes/1",

View File

@ -26,7 +26,10 @@ from tests.api.tools_test_api import verify_fields
# formations # formations
def test_formations_ids(api_headers): def test_formations_ids(api_headers):
""" """
Route: /formations_ids Test 'formations_ids'
Routes :
- /formations_ids
""" """
r = requests.get( r = requests.get(
API_URL + "/formations_ids", API_URL + "/formations_ids",
@ -44,7 +47,10 @@ def test_formations_ids(api_headers):
# formations_by_id # formations_by_id
def test_formations_by_id(api_headers): def test_formations_by_id(api_headers):
""" """
Route: /formations/<int:formation_id> Test 'formations_by_id'
Routes :
- /formations/<int:formation_id>
""" """
fields = [ fields = [
"id", "id",
@ -75,7 +81,11 @@ def test_formations_by_id(api_headers):
def test_formation_export(api_headers): def test_formation_export(api_headers):
""" """
Route: /formations/formation_export/<int:formation_id> Test 'formation_export_by_formation_id'
Routes :
- /formations/formation_export/<int:formation_id>
- /formations/formation_export/<int:formation_id>/with_ids
""" """
fields = [ fields = [
"id", "id",
@ -105,19 +115,12 @@ def test_formation_export(api_headers):
# TODO tester le contenu de certains champs # TODO tester le contenu de certains champs
# TODO
# def test_formsemestre_apo(api_headers):
# r = requests.get(
# API_URL + "/formations/apo/<string:etape_apo>",
# headers=api_headers,
# verify=CHECK_CERTIFICATE,
# )
# assert r.status_code == 200
def test_moduleimpl(api_headers): def test_moduleimpl(api_headers):
""" """
Route: /formations/moduleimpl/<int:moduleimpl_id> Test 'moduleimpl'
Route :
- /formations/moduleimpl/<int:moduleimpl_id>
""" """
fields = [ fields = [
"id", "id",
@ -145,7 +148,10 @@ def test_moduleimpl(api_headers):
def test_moduleimpls_sem(api_headers): def test_moduleimpls_sem(api_headers):
""" """
Route: /formations/moduleimpl/formsemestre/<int:formsemestre_id>/list Test 'moduleimpls_sem'
Route :
- /formations/moduleimpl/formsemestre/<int:formsemestre_id>/list
""" """
fields = [ fields = [
"id", "id",
@ -175,7 +181,10 @@ def test_moduleimpls_sem(api_headers):
def test_referentiel_competences(api_headers): def test_referentiel_competences(api_headers):
""" """
Route: "/formations/<int:formation_id>/referentiel_competences", Test 'referentiel_competences'
Route :
- /formations/<int:formation_id>/referentiel_competences
""" """
r = requests.get( r = requests.get(
API_URL + "/formations/1/referentiel_competences", API_URL + "/formations/1/referentiel_competences",

View File

@ -25,7 +25,10 @@ from tests.api.tools_test_api import verify_fields
def test_formsemestre(api_headers): def test_formsemestre(api_headers):
""" """
Route: Test 'formsemestre'
Route :
- /formsemestre/<int:formsemestre_id>
""" """
r = requests.get( r = requests.get(
API_URL + "/formsemestre/1", API_URL + "/formsemestre/1",
@ -69,35 +72,28 @@ def test_formsemestre(api_headers):
assert fields_ok is True assert fields_ok is True
def test_etudiant_bulletin(api_headers): # TODO
""" # def test_formsemestre_apo(api_headers):
Route: # """
""" # Test 'formsemestre_apo'
r = requests.get( #
API_URL + "/formsemestre/1/etudiant/etudid/1/bulletin", # Route :
headers=api_headers, # - /formsemestre/apo/<string:etape_apo>
verify=CHECK_CERTIFICATE, # """
) # r = requests.get(
assert r.status_code == 200 # API_URL + "/formations/apo/<string:etape_apo>",
# headers=api_headers,
r = requests.get( # verify=CHECK_CERTIFICATE,
API_URL + "/formsemestre/1/etudiant/nip/1/bulletin", # )
headers=api_headers, # assert r.status_code == 200
verify=CHECK_CERTIFICATE,
)
assert r.status_code == 200
r = requests.get(
API_URL + "/formsemestre/1/etudiant/ine/1/bulletin",
headers=api_headers,
verify=CHECK_CERTIFICATE,
)
assert r.status_code == 200
def test_bulletins(api_headers): def test_bulletins(api_headers):
""" """
Route: Test 'bulletins'
Route :
- /formsemestre/<int:formsemestre_id>/bulletins
""" """
r = requests.get( r = requests.get(
API_URL + "/formsemestre/1/bulletins", API_URL + "/formsemestre/1/bulletins",
@ -109,6 +105,12 @@ def test_bulletins(api_headers):
# # jury # # jury
# def test_jury(): # def test_jury():
# """
# Test 'jury'
#
# Route :
# - /formsemestre/<int:formsemestre_id>/jury
# """
# r = requests.get( # r = requests.get(
# API_URL + "/formsemestre/1/jury", # API_URL + "/formsemestre/1/jury",
# headers=api_headers, # headers=api_headers,
@ -117,9 +119,12 @@ def test_bulletins(api_headers):
# assert r.status_code == 200 # assert r.status_code == 200
# TODO A revoir # TODO A revoir
def test_semestre_index(api_headers): def test_programme(api_headers):
""" """
Route: TODO Test 'programme'
Route :
- /formsemestre/<int:formsemestre_id>/programme
""" """
ue_fields = [ ue_fields = [
"semestre_idx", "semestre_idx",

View File

@ -24,10 +24,13 @@ from tests.api.setup_test_api import API_URL, CHECK_CERTIFICATE, api_headers
def test_jury_preparation(api_headers): def test_jury_preparation(api_headers):
""" """
Route: Test 'jury_preparation'
Route :
- /jury/formsemestre/<int:formsemestre_id>/preparation_jury
""" """
r = requests.get( r = requests.get(
SCODOC_URL API_URL
+ "/ScoDoc/api/jury/formsemestre/<int:formsemestre_id>/preparation_jury", + "/ScoDoc/api/jury/formsemestre/<int:formsemestre_id>/preparation_jury",
headers=api_headers, headers=api_headers,
verify=CHECK_CERTIFICATE, verify=CHECK_CERTIFICATE,
@ -37,7 +40,10 @@ def test_jury_preparation(api_headers):
def test_jury_decisions(api_headers): def test_jury_decisions(api_headers):
""" """
Route: Test 'jury_decisions'
Route :
- /jury/formsemestre/<int:formsemestre_id>/decisions_jury
""" """
r = requests.get( r = requests.get(
API_URL + "/jury/formsemestre/<int:formsemestre_id>/decisions_jury", API_URL + "/jury/formsemestre/<int:formsemestre_id>/decisions_jury",
@ -45,62 +51,3 @@ def test_jury_decisions(api_headers):
verify=CHECK_CERTIFICATE, verify=CHECK_CERTIFICATE,
) )
assert r.status_code == 200 assert r.status_code == 200
# set_decision_jury
def test_set_decision_jury(api_headers):
r = requests.get(
SCODOC_URL
+ "/ScoDoc/api/jury/set_decision/etudid?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
headers=api_headers,
verify=CHECK_CERTIFICATE,
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL
+ "/ScoDoc/api/jury/set_decision/nip?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
headers=api_headers,
verify=CHECK_CERTIFICATE,
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL
+ "/ScoDoc/api/jury/set_decision/ine?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
headers=api_headers,
verify=CHECK_CERTIFICATE,
)
assert r.status_code == 200
def test_annule_decision_jury(api_headers):
"""
Route:
"""
r = requests.get(
SCODOC_URL
+ "/ScoDoc/api/jury/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/annule_decision",
headers=api_headers,
verify=CHECK_CERTIFICATE,
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL
+ "/ScoDoc/api/jury/nip/<int:nip>/formsemestre/<int:formsemestre_id>/annule_decision",
headers=api_headers,
verify=CHECK_CERTIFICATE,
)
assert r.status_code == 200
r = requests.get(
SCODOC_URL
+ "/ScoDoc/api/jury/ine/<int:ine>/formsemestre/<int:formsemestre_id>/annule_decision",
headers=api_headers,
verify=CHECK_CERTIFICATE,
)
assert r.status_code == 200

View File

@ -25,7 +25,10 @@ from tests.api.tools_test_api import verify_fields
def test_partition(api_headers): def test_partition(api_headers):
""" """
Route: Test 'partition'
Route :
- /partitions/<int:formsemestre_id>
""" """
fields = [ fields = [
"partition_id", "partition_id",
@ -52,7 +55,11 @@ def test_partition(api_headers):
def test_etud_in_group(api_headers): def test_etud_in_group(api_headers):
""" """
Route: Test 'etud_in_group'
Routes :
- /partitions/groups/<int:group_id>
- /partitions/groups/<int:group_id>/etat/<string:etat>
""" """
fields = [ fields = [
"etudid", "etudid",
@ -116,7 +123,11 @@ def test_etud_in_group(api_headers):
# # set_groups # # set_groups
# def test_set_groups(api_headers): # def test_set_groups(api_headers):
# """ # """
# Route: # Test 'set_groups'
#
# Routes :
# - /partitions/set_groups/partition/<int:partition_id>/groups/<string:groups_id>/delete/<string:groups_to_delete>"
# "/create/<string:groups_to_create>
# """ # """
# r = requests.get( # r = requests.get(
# SCODOC_URL # SCODOC_URL

View File

@ -29,7 +29,7 @@ def test_permissions(api_headers):
# Ce test va récupérer toutes les routes de l'API # Ce test va récupérer toutes les routes de l'API
app = create_app(RunningConfig) app = create_app(RunningConfig)
assert app assert app
# Les routes de l'API avec GET, excluant les logos pour le momeent XXX # Les routes de l'API avec GET, excluant les logos pour le moment XXX
api_rules = [ api_rules = [
r r
for r in app.url_map.iter_rules() for r in app.url_map.iter_rules()