Skip to content
Snippets Groups Projects
Commit 0dda9157 authored by Emmanuel Viennet's avatar Emmanuel Viennet
Browse files

Adapte tests unitaires - OK

parent 90fd45a5
Branches
No related tags found
No related merge requests found
......@@ -31,7 +31,13 @@ def test_cursus_but_jury_gb(test_client):
app.set_sco_dept(DEPT)
# login_user(User.query.filter_by(user_name="admin").first()) # XXX pour tests manuels
# ctx.push() # XXX
doc = yaml_setup.setup_from_yaml("tests/ressources/yaml/cursus_but_gb.yaml")
doc, formation, formsemestre_titres = yaml_setup.setup_from_yaml(
"tests/ressources/yaml/cursus_but_gb.yaml"
)
for formsemestre_titre in formsemestre_titres:
formsemestre = yaml_setup.create_formsemestre_with_etuds(
doc, formation, formsemestre_titre
)
formsemestre: FormSemestre = FormSemestre.query.filter_by(titre="S3").first()
res: ResultatsSemestreBUT = res_sem.load_formsemestre_results(formsemestre)
cursus = FormSemestreCursusBUT(res)
......@@ -72,7 +78,13 @@ def test_refcomp_niveaux_info(test_client):
# WIP
# pour le moment juste le chargement de la formation, du ref. comp, et des UE du S4.
app.set_sco_dept(DEPT)
doc = yaml_setup.setup_from_yaml("tests/ressources/yaml/cursus_but_info.yaml")
doc, formation, formsemestre_titres = yaml_setup.setup_from_yaml(
"tests/ressources/yaml/cursus_but_info.yaml"
)
for formsemestre_titre in formsemestre_titres:
formsemestre = yaml_setup.create_formsemestre_with_etuds(
doc, formation, formsemestre_titre
)
formsemestre: FormSemestre = FormSemestre.query.filter_by(titre="S4").first()
assert formsemestre
res: ResultatsSemestreBUT = res_sem.load_formsemestre_results(formsemestre)
......@@ -44,9 +44,18 @@ def test_formsemestres_associate_new_version(test_client):
app.set_sco_dept(DEPT)
# Construit la base de test GB une seule fois
# puis lance les tests de jury
yaml_setup.setup_from_yaml("tests/ressources/yaml/simple_formsemestres.yaml")
formation = Formation.query.filter_by(acronyme="BUT GEII", version=1).first()
doc, formation, formsemestre_titres = yaml_setup.setup_from_yaml(
"tests/ressources/yaml/simple_formsemestres.yaml"
)
for formsemestre_titre in formsemestre_titres:
formsemestre = yaml_setup.create_formsemestre_with_etuds(
doc, formation, formsemestre_titre
)
assert formsemestre
formation_geii = Formation.query.filter_by(acronyme="BUT GEII", version=1).first()
assert formation_geii.id == formation.id
formsemestres = formation.formsemestres.all()
assert len(formsemestres) == len(formsemestre_titres)
# On a deux S1:
assert len(formsemestres) == 2
assert {s.semestre_id for s in formsemestres} == {1}
......@@ -70,7 +79,14 @@ def test_formsemestre_misc_views(test_client):
Note: les anciennes vues renvoient souvent des str au lieu de Response.
"""
app.set_sco_dept(DEPT)
yaml_setup.setup_from_yaml("tests/ressources/yaml/simple_formsemestres.yaml")
doc, formation, formsemestre_titres = yaml_setup.setup_from_yaml(
"tests/ressources/yaml/simple_formsemestres.yaml"
)
for formsemestre_titre in formsemestre_titres:
formsemestre = yaml_setup.create_formsemestre_with_etuds(
doc, formation, formsemestre_titre
)
assert formsemestre
formsemestre: FormSemestre = FormSemestre.query.first()
# ----- MENU SEMESTRE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment