Fix API unit tests (assoc niveaux formation test)

This commit is contained in:
Emmanuel Viennet 2024-02-21 15:57:38 +01:00
parent f31eca97bb
commit 09d59848d6

View File

@ -78,6 +78,13 @@ def import_formation(dept_id: int) -> Formation:
) )
formation.referentiel_competence_id = ref_comp.id formation.referentiel_competence_id = ref_comp.id
db.session.add(formation) db.session.add(formation)
# --- Association niveaux de compétences aux UE de S1:
niveaux = ref_comp.get_niveaux_by_parcours(1)[1]["TC"]
ues = formation.ues.filter_by(semestre_idx=1).all()
assert len(niveaux) == len(ues) # le ref comp et les formation doivent correspondre
for ue, niveau in zip(ues, niveaux):
ue.niveau_competence = niveau
db.session.add(ue)
db.session.commit() db.session.commit()
return formation return formation