From 09d59848d6282cc9902ef962f8fd7fa823f3cb42 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 21 Feb 2024 15:57:38 +0100 Subject: [PATCH] Fix API unit tests (assoc niveaux formation test) --- tools/fakedatabase/create_test_api_database.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/fakedatabase/create_test_api_database.py b/tools/fakedatabase/create_test_api_database.py index 79997e1f3..5b3e96a2c 100644 --- a/tools/fakedatabase/create_test_api_database.py +++ b/tools/fakedatabase/create_test_api_database.py @@ -78,6 +78,13 @@ def import_formation(dept_id: int) -> Formation: ) formation.referentiel_competence_id = ref_comp.id 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() return formation