From 7cb6dd66c3c0a7b471288f150afe3b1075d3eba9 Mon Sep 17 00:00:00 2001 From: leonard_montalbano Date: Fri, 24 Jun 2022 16:04:40 +0200 Subject: [PATCH] debut d'ajout d'etapes apoge pour la base de tests unitaires --- app/models/formsemestre.py | 5 +++++ tools/fakedatabase/create_test_api_database.py | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index ffba1f3b5..16623bbfd 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -474,6 +474,11 @@ class FormSemestreEtape(db.Model): # etape_apo aurait du etre not null, mais oublié etape_apo = db.Column(db.String(APO_CODE_STR_LEN), index=True) + def __init__(self, id, formsemestre_id, etape_apo): + self.id = id + self.formsemestre_id = formsemestre_id + self.etape_apo = etape_apo + def __bool__(self): "Etape False if code empty" return self.etape_apo is not None and (len(self.etape_apo) > 0) diff --git a/tools/fakedatabase/create_test_api_database.py b/tools/fakedatabase/create_test_api_database.py index ee630e54b..339d23b31 100644 --- a/tools/fakedatabase/create_test_api_database.py +++ b/tools/fakedatabase/create_test_api_database.py @@ -482,6 +482,14 @@ def add_absences(formsemestre: FormSemestre): id_db += 1 +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 + + def init_test_database(): """Appelé par la commande `flask init-test-database`