From 39873183a8e378bda25dc569dde2293c2fb9fc1b Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 21 Jun 2024 01:27:05 +0200 Subject: [PATCH] Fix bug feuille prepa jury non BUT + ajoute test unitaire --- app/scodoc/sco_prepajury.py | 7 +------ tests/unit/test_but_jury.py | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/scodoc/sco_prepajury.py b/app/scodoc/sco_prepajury.py index 369c11a8d..0c552d6fc 100644 --- a/app/scodoc/sco_prepajury.py +++ b/app/scodoc/sco_prepajury.py @@ -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 diff --git a/tests/unit/test_but_jury.py b/tests/unit/test_but_jury.py index ca61d2c60..3a4284b7a 100644 --- a/tests/unit/test_but_jury.py +++ b/tests/unit/test_but_jury.py @@ -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