From 636aa25f2ab4d79028cbe82c74fda99bb6cdda7e Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 18 Dec 2022 12:25:34 -0300 Subject: [PATCH] =?UTF-8?q?Tests=20Yaml:=20v=C3=A9rification=20des=20r?= =?UTF-8?q?=C3=A9sultats=20jury=20+=20fix=20explanation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/but/jury_but.py | 2 +- tests/unit/cursus_but_gb.yaml | 2 +- tests/unit/test_but_jury.py | 48 ++++++++++++++--------------------- 3 files changed, 21 insertions(+), 31 deletions(-) diff --git a/app/but/jury_but.py b/app/but/jury_but.py index 7521d2826..d79bde0e9 100644 --- a/app/but/jury_but.py +++ b/app/but/jury_but.py @@ -1027,7 +1027,7 @@ class DecisionsProposeesUE(DecisionsProposees): self.moy_ue > (sco_codes.ParcoursBUT.BARRE_MOY - sco_codes.NOTES_TOLERANCE) ) or self.formsemestre.modalite == "EXT": self.codes.insert(0, sco_codes.ADM) - self.explanation = (f"Moyenne >= {sco_codes.ParcoursBUT.BARRE_MOY}/20",) + self.explanation = f"Moyenne >= {sco_codes.ParcoursBUT.BARRE_MOY}/20" elif self.rcue and self.rcue.est_compensable(): self.codes.insert(0, sco_codes.CMP) self.explanation = "compensable dans le RCUE" diff --git a/tests/unit/cursus_but_gb.yaml b/tests/unit/cursus_but_gb.yaml index cb92040ae..77eb5b81e 100644 --- a/tests/unit/cursus_but_gb.yaml +++ b/tests/unit/cursus_but_gb.yaml @@ -141,7 +141,7 @@ Etudiants: "SAÉ 1.SEE.03": 18 # UE13 => sera capitalisée "SAÉ 1.SEE.04": 7 # UE14 ratée attendu: # les codes jury que l'on doit vérifier - deca: + deca: # decision année passage_de_droit: False res_pair: None codes: [ "RED", "..." ] diff --git a/tests/unit/test_but_jury.py b/tests/unit/test_but_jury.py index 565f827f2..c22f18d58 100644 --- a/tests/unit/test_but_jury.py +++ b/tests/unit/test_but_jury.py @@ -35,10 +35,12 @@ def test_but_jury_GB(test_client): _check_deca(formsemestre) S1: FormSemestre = FormSemestre.query.filter_by(titre="S1_SEE").first() - _test_but_jury_S1(S1) - _test_but_jury_S2() - _test_but_jury_S3() - _test_but_jury_S1_redoublant() + _test_but_jury(S1, doc) + S2: FormSemestre = FormSemestre.query.filter_by(titre="S2_SEE").first() + _test_but_jury(S2, doc) + S3: FormSemestre = FormSemestre.query.filter_by(titre="S3").first() + _test_but_jury(S3, doc) + # _test_but_jury(S1_redoublant, doc) def _check_deca(formsemestre: FormSemestre, etud: Identite = None): @@ -83,29 +85,17 @@ def _check_deca(formsemestre: FormSemestre, etud: Identite = None): assert deca.nb_competences == nb_ues_un_sem -def _test_but_jury_S1(formsemestre: FormSemestre): - """Test jurys BUT1 avec un seul parcours. - Vérifie aussi les champs de DecisionsProposeesAnnee +def _test_but_jury(formsemestre: FormSemestre, doc: dict): + """Test jurys + Vérifie les champs de DecisionsProposeesAnnee et UEs """ - etud: Identite = formsemestre.etuds.first() - - # XXX à compléter avec le jury quand on aura décidé des notes - - -def _test_but_jury_S2(): - pass - - -def _test_but_jury_S3(): - """Test jurys BUT2/S3 avec 2 parcours dans le sem.""" - formsemestre: FormSemestre = FormSemestre.query.filter_by(titre="S3").first() - etud: Identite = formsemestre.etuds.filter_by( - prenom="Étudiant_SEE" - ).first() # du parcours SEE - assert etud - deca = DecisionsProposeesAnnee(etud, formsemestre) - assert len(deca.niveaux_competences) == 5 # 5 compétences dans ce parcours - - -def _test_but_jury_S1_redoublant(): - pass + for etud in formsemestre.etuds: + deca = DecisionsProposeesAnnee(etud, formsemestre) + doc_formsemestre = doc["Etudiants"][etud.nom]["formsemestres"][ + formsemestre.titre + ] + assert doc_formsemestre + if "attendu" in doc_formsemestre: + if "deca" in doc_formsemestre["attendu"]: + deca_att = doc_formsemestre["attendu"]["deca"] + yaml_setup.compare_decisions_annee(deca, deca_att)