Fix bug feuille prepa jury non BUT + ajoute test unitaire

This commit is contained in:
Emmanuel Viennet 2024-06-21 01:27:05 +02:00
parent a8703edfc5
commit 39873183a8
2 changed files with 15 additions and 10 deletions

View File

@ -129,12 +129,7 @@ def feuille_preparation_jury(formsemestre_id):
# parcours:
parcours[etud.id] = Se.get_cursus_descr()
# groupe principal (td)
groupestd[etud.id] = ""
for s in Se.etud["sems"]:
if s["formsemestre_id"] == formsemestre_id:
groupestd[etud.id] = etud_groups.get(etud.id, {}).get(
main_partition_id, ""
)
groupestd[etud.id] = etud_groups.get(etud.id, {}).get(main_partition_id, "")
# absences:
_, nbabsjust[etud.id], nbabs[etud.id] = sco_assiduites.get_assiduites_count(
etud.id, sem

View File

@ -25,18 +25,21 @@ from tests.unit import yaml_setup, yaml_setup_but
import app
from app.but.jury_but_validation_auto import formsemestre_validation_auto_but
from app.models import Formation, FormSemestre, UniteEns
from app.scodoc import sco_prepajury
from config import TestConfig
DEPT = TestConfig.DEPT_TEST
def setup_and_test_jurys(yaml_filename: str):
"Charge YAML et lance test jury BUT"
def setup_and_test_jurys(yaml_filename: str) -> FormSemestre | None:
"""Charge YAML et lance test jury BUT.
Rennvoie le dernier formsemestre s'il y en a un.
"""
app.set_sco_dept(DEPT)
# Construit la base de test GB une seule fois
# puis lance les tests de jury
doc, formation, formsemestre_titres = yaml_setup.setup_from_yaml(yaml_filename)
formsemestre = None
for formsemestre_titre in formsemestre_titres:
formsemestre = yaml_setup.create_formsemestre_with_etuds(
doc, formation, formsemestre_titre
@ -48,6 +51,7 @@ def setup_and_test_jurys(yaml_filename: str):
# et vérification des résultats attendus:
formsemestre_validation_auto_but(formsemestre, only_adm=False)
yaml_setup_but.but_test_jury(formsemestre, doc)
return formsemestre
@pytest.mark.slow
@ -59,8 +63,14 @@ def test_but_jury_GB(test_client):
- vérification jury de S2
- vérification jury de S3
- vérification jury de S1 avec redoublants et capitalisations
puis:
- teste feuille prepajury
"""
setup_and_test_jurys("tests/ressources/yaml/cursus_but_gb.yaml")
formsemestre: FormSemestre = setup_and_test_jurys(
"tests/ressources/yaml/cursus_but_gb.yaml"
)
# Test feuille préparation jury
sco_prepajury.feuille_preparation_jury(formsemestre.id)
@pytest.mark.slow