From 864d90e22c2eca70e8e4c08439e96e4184450e1b Mon Sep 17 00:00:00 2001 From: leonard_montalbano Date: Fri, 6 May 2022 16:05:34 +0200 Subject: [PATCH] ajout des docstring des fonctions de test --- tests/api/test_api_absences.py | 23 ++++++++-- tests/api/test_api_departements.py | 22 ++++++++- tests/api/test_api_etudiants.py | 47 +++++++++++++++++--- tests/api/test_api_evaluations.py | 10 ++++- tests/api/test_api_formations.py | 41 ++++++++++------- tests/api/test_api_formsemestre.py | 61 +++++++++++++------------ tests/api/test_api_jury.py | 71 ++++-------------------------- tests/api/test_api_partitions.py | 17 +++++-- tests/api/test_api_permissions.py | 2 +- 9 files changed, 170 insertions(+), 124 deletions(-) diff --git a/tests/api/test_api_absences.py b/tests/api/test_api_absences.py index a0a90c57..1ab83b18 100644 --- a/tests/api/test_api_absences.py +++ b/tests/api/test_api_absences.py @@ -28,7 +28,12 @@ NIP = "1" # absences def test_absences(api_headers): """ - Route: /absences/etudid/ + Test 'absences' + + Routes : + - /absences/etudid/ + - /absences/nip/ + - /absences/ine/ """ r = requests.get( f"{API_URL}/absences/etudid/{ETUDID}", @@ -55,7 +60,12 @@ def test_absences(api_headers): # absences_justify def test_absences_justify(api_headers): """ - Route: /absences/etudid//just + Test 'absences_just' + + Routes : + - /absences/etudid//just + - /absences/nip//just + - /absences/ine//just """ r = requests.get( API_URL + f"/absences/etudid/{ETUDID}/just", @@ -85,10 +95,15 @@ def test_absences_justify(api_headers): # XXX TODO # def test_abs_groupe_etat(api_headers): # """ -# Route: +# Test 'abs_groupe_etat' +# +# Routes : +# - /absences/abs_group_etat/ +# - /absences/abs_group_etat/group_id//date_debut//date_fin/ # """ # r = requests.get( -# API_URL + "/absences/abs_group_etat/?group_id=&date_debut=date_debut&date_fin=date_fin", +# API_URL + "/absences/abs_group_etat/group_id//date_debut//" +# "date_fin/", # headers=api_headers, # verify=CHECK_CERTIFICATE, # ) diff --git a/tests/api/test_api_departements.py b/tests/api/test_api_departements.py index 872aa104..bb7dec66 100644 --- a/tests/api/test_api_departements.py +++ b/tests/api/test_api_departements.py @@ -24,7 +24,13 @@ from tests.api.tools_test_api import verify_fields def test_departements(api_headers): - "check liste de sdépartements" + """ + Test 'departements' + + Route : + - /departements + """ + fields = [ "id", "acronym", @@ -49,6 +55,13 @@ def test_departements(api_headers): def test_list_etudiants(api_headers): + """ + Test 'list_etudiants' + + Routes : + - /departements//etudiants/list + - /departements//etudiants/list/ + """ fields = { "civilite", "code_ine", @@ -107,6 +120,12 @@ def test_list_etudiants(api_headers): # liste_semestres_courant def test_semestres_courant(api_headers): + """ + Test 'liste_semestres_courant' + + Route : + - /departements//semestres_courants + """ fields = [ "titre", "gestion_semestrielle", @@ -133,6 +152,7 @@ def test_semestres_courant(api_headers): "date_debut_iso", "date_fin_iso", "responsables", + "titre_court", ] r = requests.get( diff --git a/tests/api/test_api_etudiants.py b/tests/api/test_api_etudiants.py index ec6a23d1..db53475d 100644 --- a/tests/api/test_api_etudiants.py +++ b/tests/api/test_api_etudiants.py @@ -26,7 +26,11 @@ from tests.api.tools_test_api import verify_fields # etudiants_courant def test_etudiants_courant(api_headers): """ - Route: /etudiants/courant + Test 'etudiants_courant' + + Routes : + - /etudiants/courant + - /etudiants/courant/long """ fields = [ "id", @@ -98,7 +102,12 @@ def test_etudiants_courant(api_headers): def test_etudiant(api_headers): """ - Route: + Test 'etudiant' + + Routes : + - /etudiant/etudid/ + - /etudiant/nip/ + - /etudiant/ine/ """ fields = [ "civilite", @@ -169,7 +178,12 @@ def test_etudiant(api_headers): def test_etudiant_formsemestres(api_headers): """ - Route: /etudiant/etudid//formsemestres + Test 'etudiant_formsemestres' + + Routes : + - /etudiant/etudid//formsemestres + - /etudiant/nip//formsemestres + - /etudiant/ine//formsemestres """ fields = [ "date_fin", @@ -197,6 +211,7 @@ def test_etudiant_formsemestres(api_headers): "date_debut_iso", "date_fin_iso", "responsables", + "titre_court", ] ######### Test etudid ######### @@ -248,8 +263,22 @@ def test_etudiant_formsemestres(api_headers): def test_etudiant_bulletin_semestre(api_headers): """ - Route: /etudiant/etudid//formsemestre//bulletin - """ + Test 'etudiant_bulletin_semestre' + + Routes : + - /etudiant/etudid//formsemestre//bulletin + - /etudiant/nip//formsemestre//bulletin + - /etudiant/ine//formsemestre//bulletin + - /etudiant/etudid//formsemestre//bulletin/pdf + - /etudiant/nip//formsemestre//bulletin/pdf + - /etudiant/ine//formsemestre//bulletin/pdf + - /etudiant/etudid//formsemestre//bulletin/short + - /etudiant/nip//formsemestre//bulletin/short + - /etudiant/ine//formsemestre//bulletin/short + - /etudiant/etudid//formsemestre//bulletin/short/pdf + - /etudiant/nip//formsemestre//bulletin/short/pdf + - /etudiant/ine//formsemestre//bulletin/short/pdf + """ ######### Test etudid ######### r = requests.get( @@ -285,8 +314,12 @@ def test_etudiant_bulletin_semestre(api_headers): def test_etudiant_groups(api_headers): """ - Route: - /etudiant/etudid//formsemestre//groups + Test 'etudiant_groups' + + Routes : + - /etudiant/etudid//formsemestre//groups + - /etudiant/nip//formsemestre//groups + - /etudiant/ine//formsemestre//groups """ fields = [ "partition_id", diff --git a/tests/api/test_api_evaluations.py b/tests/api/test_api_evaluations.py index 976eef61..1453f3a1 100644 --- a/tests/api/test_api_evaluations.py +++ b/tests/api/test_api_evaluations.py @@ -24,7 +24,10 @@ from tests.api.setup_test_api import API_URL, CHECK_CERTIFICATE, api_headers def test_evaluations(api_headers): """ - Route: /evaluation/ + Test 'evaluations' + + Route : + - /evaluations/ """ r = requests.get( API_URL + "/evaluations/1", @@ -38,7 +41,10 @@ def test_evaluations(api_headers): # TODO car pas d'évaluations créées à ce stade # def test_evaluation_notes(api_headers): # """ -# Route: /evaluation/eval_notes/ +# Test 'evaluation_notes' +# +# Route : +# - /evaluation/eval_notes/ # """ # r = requests.get( # API_URL + "/evaluation/eval_notes/1", diff --git a/tests/api/test_api_formations.py b/tests/api/test_api_formations.py index b8f159ad..3f65ac6e 100644 --- a/tests/api/test_api_formations.py +++ b/tests/api/test_api_formations.py @@ -26,7 +26,10 @@ from tests.api.tools_test_api import verify_fields # formations def test_formations_ids(api_headers): """ - Route: /formations_ids + Test 'formations_ids' + + Routes : + - /formations_ids """ r = requests.get( API_URL + "/formations_ids", @@ -44,7 +47,10 @@ def test_formations_ids(api_headers): # formations_by_id def test_formations_by_id(api_headers): """ - Route: /formations/ + Test 'formations_by_id' + + Routes : + - /formations/ """ fields = [ "id", @@ -75,7 +81,11 @@ def test_formations_by_id(api_headers): def test_formation_export(api_headers): """ - Route: /formations/formation_export/ + Test 'formation_export_by_formation_id' + + Routes : + - /formations/formation_export/ + - /formations/formation_export//with_ids """ fields = [ "id", @@ -105,19 +115,12 @@ def test_formation_export(api_headers): # TODO tester le contenu de certains champs -# TODO -# def test_formsemestre_apo(api_headers): -# r = requests.get( -# API_URL + "/formations/apo/", -# headers=api_headers, -# verify=CHECK_CERTIFICATE, -# ) -# assert r.status_code == 200 - - def test_moduleimpl(api_headers): """ - Route: /formations/moduleimpl/ + Test 'moduleimpl' + + Route : + - /formations/moduleimpl/ """ fields = [ "id", @@ -145,7 +148,10 @@ def test_moduleimpl(api_headers): def test_moduleimpls_sem(api_headers): """ - Route: /formations/moduleimpl/formsemestre//list + Test 'moduleimpls_sem' + + Route : + - /formations/moduleimpl/formsemestre//list """ fields = [ "id", @@ -175,7 +181,10 @@ def test_moduleimpls_sem(api_headers): def test_referentiel_competences(api_headers): """ - Route: "/formations//referentiel_competences", + Test 'referentiel_competences' + + Route : + - /formations//referentiel_competences """ r = requests.get( API_URL + "/formations/1/referentiel_competences", diff --git a/tests/api/test_api_formsemestre.py b/tests/api/test_api_formsemestre.py index 724713a1..568e7e8d 100644 --- a/tests/api/test_api_formsemestre.py +++ b/tests/api/test_api_formsemestre.py @@ -25,7 +25,10 @@ from tests.api.tools_test_api import verify_fields def test_formsemestre(api_headers): """ - Route: + Test 'formsemestre' + + Route : + - /formsemestre/ """ r = requests.get( API_URL + "/formsemestre/1", @@ -69,35 +72,28 @@ def test_formsemestre(api_headers): assert fields_ok is True -def test_etudiant_bulletin(api_headers): - """ - Route: - """ - r = requests.get( - API_URL + "/formsemestre/1/etudiant/etudid/1/bulletin", - headers=api_headers, - verify=CHECK_CERTIFICATE, - ) - assert r.status_code == 200 - - r = requests.get( - API_URL + "/formsemestre/1/etudiant/nip/1/bulletin", - headers=api_headers, - 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 +# TODO +# def test_formsemestre_apo(api_headers): +# """ +# Test 'formsemestre_apo' +# +# Route : +# - /formsemestre/apo/ +# """ +# r = requests.get( +# API_URL + "/formations/apo/", +# headers=api_headers, +# verify=CHECK_CERTIFICATE, +# ) +# assert r.status_code == 200 def test_bulletins(api_headers): """ - Route: + Test 'bulletins' + + Route : + - /formsemestre//bulletins """ r = requests.get( API_URL + "/formsemestre/1/bulletins", @@ -109,6 +105,12 @@ def test_bulletins(api_headers): # # jury # def test_jury(): +# """ +# Test 'jury' +# +# Route : +# - /formsemestre//jury +# """ # r = requests.get( # API_URL + "/formsemestre/1/jury", # headers=api_headers, @@ -117,9 +119,12 @@ def test_bulletins(api_headers): # assert r.status_code == 200 # TODO A revoir -def test_semestre_index(api_headers): +def test_programme(api_headers): """ - Route: TODO + Test 'programme' + + Route : + - /formsemestre//programme """ ue_fields = [ "semestre_idx", diff --git a/tests/api/test_api_jury.py b/tests/api/test_api_jury.py index 13b0a0f1..003f148f 100644 --- a/tests/api/test_api_jury.py +++ b/tests/api/test_api_jury.py @@ -24,10 +24,13 @@ from tests.api.setup_test_api import API_URL, CHECK_CERTIFICATE, api_headers def test_jury_preparation(api_headers): """ - Route: + Test 'jury_preparation' + + Route : + - /jury/formsemestre//preparation_jury """ r = requests.get( - SCODOC_URL + API_URL + "/ScoDoc/api/jury/formsemestre//preparation_jury", headers=api_headers, verify=CHECK_CERTIFICATE, @@ -37,7 +40,10 @@ def test_jury_preparation(api_headers): def test_jury_decisions(api_headers): """ - Route: + Test 'jury_decisions' + + Route : + - /jury/formsemestre//decisions_jury """ r = requests.get( API_URL + "/jury/formsemestre//decisions_jury", @@ -45,62 +51,3 @@ def test_jury_decisions(api_headers): verify=CHECK_CERTIFICATE, ) 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=&formsemestre_id=" - "&jury=&devenir=&assiduite=", - headers=api_headers, - verify=CHECK_CERTIFICATE, - ) - assert r.status_code == 200 - - r = requests.get( - SCODOC_URL - + "/ScoDoc/api/jury/set_decision/nip?etudid=&formsemestre_id=" - "&jury=&devenir=&assiduite=", - headers=api_headers, - verify=CHECK_CERTIFICATE, - ) - assert r.status_code == 200 - - r = requests.get( - SCODOC_URL - + "/ScoDoc/api/jury/set_decision/ine?etudid=&formsemestre_id=" - "&jury=&devenir=&assiduite=", - 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//formsemestre//annule_decision", - headers=api_headers, - verify=CHECK_CERTIFICATE, - ) - assert r.status_code == 200 - - r = requests.get( - SCODOC_URL - + "/ScoDoc/api/jury/nip//formsemestre//annule_decision", - headers=api_headers, - verify=CHECK_CERTIFICATE, - ) - assert r.status_code == 200 - - r = requests.get( - SCODOC_URL - + "/ScoDoc/api/jury/ine//formsemestre//annule_decision", - headers=api_headers, - verify=CHECK_CERTIFICATE, - ) - assert r.status_code == 200 diff --git a/tests/api/test_api_partitions.py b/tests/api/test_api_partitions.py index 0ceb4e33..aa8994f8 100644 --- a/tests/api/test_api_partitions.py +++ b/tests/api/test_api_partitions.py @@ -25,7 +25,10 @@ from tests.api.tools_test_api import verify_fields def test_partition(api_headers): """ - Route: + Test 'partition' + + Route : + - /partitions/ """ fields = [ "partition_id", @@ -52,7 +55,11 @@ def test_partition(api_headers): def test_etud_in_group(api_headers): """ - Route: + Test 'etud_in_group' + + Routes : + - /partitions/groups/ + - /partitions/groups//etat/ """ fields = [ "etudid", @@ -116,7 +123,11 @@ def test_etud_in_group(api_headers): # # set_groups # def test_set_groups(api_headers): # """ -# Route: +# Test 'set_groups' +# +# Routes : +# - /partitions/set_groups/partition//groups//delete/" +# "/create/ # """ # r = requests.get( # SCODOC_URL diff --git a/tests/api/test_api_permissions.py b/tests/api/test_api_permissions.py index aa80f36f..4a9f2952 100644 --- a/tests/api/test_api_permissions.py +++ b/tests/api/test_api_permissions.py @@ -29,7 +29,7 @@ def test_permissions(api_headers): # Ce test va récupérer toutes les routes de l'API app = create_app(RunningConfig) 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 = [ r for r in app.url_map.iter_rules()