1
0
forked from ScoDoc/ScoDoc

Adapte tests unitaires - OK

This commit is contained in:
Emmanuel Viennet 2023-07-01 12:36:30 +02:00
parent 90fd45a572
commit 0dda9157eb
2 changed files with 33 additions and 5 deletions

View File

@ -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)

View File

@ -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