From 35a6427e2f512b0fb20ec4e8c23b0e9efdae1b54 Mon Sep 17 00:00:00 2001 From: leonard_montalbano Date: Mon, 27 Jun 2022 16:11:48 +0200 Subject: [PATCH] =?UTF-8?q?ajout=20d'=C3=A9tapes=20apo=20dans=20la=20base?= =?UTF-8?q?=20de=20tests=20unitaires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fakedatabase/create_test_api_database.py | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tools/fakedatabase/create_test_api_database.py b/tools/fakedatabase/create_test_api_database.py index 339d23b3..c4ad78f8 100644 --- a/tools/fakedatabase/create_test_api_database.py +++ b/tools/fakedatabase/create_test_api_database.py @@ -38,7 +38,8 @@ from app.models import ( NotesNotes, ApcReferentielCompetences, ApcCompetence, - Absence, FormSemestreEtape, + Absence, + FormSemestreEtape, ) from app import db from app.models.but_refcomp import ( @@ -486,8 +487,24 @@ def create_etape_apo(formsemestre: FormSemestre): """ Ajoute étape apoge au formsemestre """ - etape_apo = FormSemestreEtape(id=1, formsemestre_id=formsemestre.id, etape_apo="A1") - formsemestre.etapes = etape_apo + etape_apo1 = FormSemestreEtape( + id=1, formsemestre_id=formsemestre.id, etape_apo="A1" + ) + db.session.add(etape_apo1) + + etape_apo2 = FormSemestreEtape( + id=2, formsemestre_id=formsemestre.id, etape_apo="A2" + ) + db.session.add(etape_apo2) + + etape_apo3 = FormSemestreEtape( + id=3, formsemestre_id=formsemestre.id, etape_apo="A3" + ) + db.session.add(etape_apo3) + + list_etapes = [etape_apo1, etape_apo2, etape_apo3] + formsemestre.etapes = list_etapes + db.session.commit() def init_test_database():