From 8dce157d06aac4e73157569f38a0eed094f30535 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 23 Feb 2023 22:42:19 +0100 Subject: [PATCH] Fix (tests unitaires) --- app/comp/res_common.py | 2 +- app/scodoc/sco_edit_ue.py | 6 +++++- tests/unit/test_formsemestre.py | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/comp/res_common.py b/app/comp/res_common.py index 74b9eb79..ce0d0e9a 100644 --- a/app/comp/res_common.py +++ b/app/comp/res_common.py @@ -300,7 +300,7 @@ class ResultatsSemestre(ResultatsCache): def get_etud_etat(self, etudid: int) -> str: "Etat de l'etudiant: 'I', 'D', DEF ou '' (si pas connu dans ce semestre)" - ins = self.formsemestre.etuds_inscriptions.get(etudid, None) + ins = self.formsemestre.etuds_inscriptions.get(etudid) if ins is None: return "" return ins.etat diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index a9e12751..e3403cc2 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -120,7 +120,11 @@ def do_ue_create(args): f"""Acronyme d'UE "{args['acronyme']}" déjà utilisé ! (chaque UE doit avoir un acronyme unique dans la formation)""" ) - if (not "ue_code" in args) or (not args["ue_code"].strip()): + if ( + (not "ue_code" in args) + or (args["ue_code"] is None) + or (not args["ue_code"].strip()) + ): # évite les conflits de code while True: cursor = db.session.execute("select notes_newid_ucod();") diff --git a/tests/unit/test_formsemestre.py b/tests/unit/test_formsemestre.py index 4ca9a551..981b114e 100644 --- a/tests/unit/test_formsemestre.py +++ b/tests/unit/test_formsemestre.py @@ -52,7 +52,9 @@ def test_formsemestres_associate_new_version(test_client): assert {s.semestre_id for s in formsemestres} == {1} # Les rattache à une nouvelle version de la formation: formsemestre_ids = [s.id for s in formsemestres] - sco_formsemestre_edit.do_formsemestres_associate_new_version(formsemestre_ids) + sco_formsemestre_edit.do_formsemestres_associate_new_version( + formation.id, formsemestre_ids + ) new_formation: Formation = Formation.query.filter_by( acronyme="BUT GEII", version=2 ).first()