Fix (tests unitaires)

This commit is contained in:
Emmanuel Viennet 2023-02-23 22:42:19 +01:00 committed by iziram
parent 50191e6f77
commit 8dce157d06
3 changed files with 9 additions and 3 deletions

View File

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

View File

@ -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();")

View File

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