diff --git a/app/views/notes.py b/app/views/notes.py index cce68b8c24dba8650935bbfe3099b28171df71f4..ddae58a1c4ef7f5e4232aba0b6cc7aef5c2b865f 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -96,7 +96,6 @@ from app.scodoc.sco_exceptions import ( from app.scodoc import ( sco_apogee_compare, sco_archives_formsemestre, - sco_assiduites, sco_bulletins, sco_bulletins_pdf, sco_cache, @@ -121,7 +120,6 @@ from app.scodoc import ( sco_inscr_passage, sco_liste_notes, sco_lycee, - sco_moduleimpl, sco_moduleimpl_inscriptions, sco_moduleimpl_status, sco_placement, @@ -865,38 +863,6 @@ def ue_clone(): # --- Semestres de formation - -@bp.route( - "/formsemestre_list", methods=["GET", "POST"] -) # pour compat anciens clients PHP -@scodoc -@permission_required_compat_scodoc7(Permission.ScoView) -@scodoc7func -def formsemestre_list( - fmt="json", - formsemestre_id=None, - formation_id=None, - etape_apo=None, -): - """List formsemestres in given format. - kw can specify some conditions: examples: - formsemestre_list( fmt='json', formation_id='F777') - """ - log("Warning: calling deprecated view formsemestre_list") - try: - formsemestre_id = int(formsemestre_id) if formsemestre_id is not None else None - formation_id = int(formation_id) if formation_id is not None else None - except ValueError: - return scu.json_error(404, "invalid id") - args = {} - L = locals() - for argname in ("formsemestre_id", "formation_id", "etape_apo"): - if L[argname] is not None: - args[argname] = L[argname] - sems = sco_formsemestre.do_formsemestre_list(args=args) - return scu.sendResult(sems, name="formsemestre", fmt=fmt) - - sco_publish( "/formsemestre_edit_options", sco_formsemestre_edit.formsemestre_edit_options, diff --git a/tests/unit/test_formations.py b/tests/unit/test_formations.py index b1634032ca755ad8d0d4c96f28dc084ce22e2444..e5bb007a33b9c4cdfe1b6839a671d11e27f2b0dd 100644 --- a/tests/unit/test_formations.py +++ b/tests/unit/test_formations.py @@ -1,8 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -""" Test creation/edition/import/export formations -""" +"""Test creation/edition/import/export formations""" # test écrit par Fares Amer, mai 2021 et porté sur ScoDoc 8 en juillet 2021 @@ -30,7 +29,6 @@ # - create_formsemestre # - create_moduleimpl # - formation_export -# - formsemestre_list # - do_module_impl_with_module_list # - do_formsemestre_delete # - Module.delete @@ -50,11 +48,10 @@ from app.formations import ( edit_ue, formation_io, ) -from app.models import Formation, Matiere, Module, ModuleImpl, UniteEns +from app.models import Formation, FormSemestre, Matiere, Module, ModuleImpl, UniteEns from app.scodoc import sco_formsemestre from app.scodoc import sco_exceptions from app.scodoc import sco_formsemestre_edit -from app.scodoc import sco_moduleimpl from app.views import notes from tests.conftest import RESOURCES_DIR @@ -197,36 +194,15 @@ def test_formations(test_client): assert load_exp["formation_id"] == formation_id # --- Liste des semestres - - li_sem1 = notes.formsemestre_list( - formsemestre_id=formsemestre_id1, fmt="json" - ).get_data(as_text=True) - assert isinstance(li_sem1, str) - load_li_sem1 = json.loads(li_sem1) # uniquement le semestre 1 dans la liste - - assert len(load_li_sem1) == 1 sem1 = sco_formsemestre.get_formsemestre(formsemestre_id1) - assert load_li_sem1[0]["date_fin"] == sem1["date_fin"] - assert load_li_sem1[0]["semestre_id"] == sem1["semestre_id"] - assert load_li_sem1[0]["formation_id"] == sem1["formation_id"] + assert sem1["formation_id"] == formation_id + formsemestre1 = FormSemestre.get_formsemestre(formsemestre_id1) + assert formsemestre1 - li_semf = notes.formsemestre_list( - formation_id=formation_id, - fmt="json", - ).get_data(as_text=True) - assert isinstance(li_semf, str) - load_li_semf = json.loads(li_semf) - - assert load_li_sem1[0] in load_li_semf - assert len(load_li_semf) == 2 sem2 = sco_formsemestre.get_formsemestre(formsemestre_id2) - assert load_li_semf[1]["semestre_id"] == sem2["semestre_id"] - - li_sem = notes.formsemestre_list(fmt="json").get_data(as_text=True) - load_li_sem = json.loads(li_sem) + assert sem2 - assert len(load_li_sem) == 3 - assert load_li_semf[0] and load_li_semf[1] in load_li_sem + assert FormSemestre.query.count() == 3 # --- Liste des modules