From 4c83c69f7c50014d9a7ce8de6b0749714cae7574 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 18 Dec 2022 22:31:42 -0300 Subject: [PATCH] =?UTF-8?q?API:=20r=C3=A9tabli=20formation.referentiel=5Fc?= =?UTF-8?q?ompetence=5Fid.=20Tous=20tests=20OK.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/formations.py | 1 - sco_version.py | 2 +- tests/api/test_api_absences.py | 7 ++----- tools/fakedatabase/create_test_api_database.py | 5 +---- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/app/models/formations.py b/app/models/formations.py index f1947f73..36e35647 100644 --- a/app/models/formations.py +++ b/app/models/formations.py @@ -67,7 +67,6 @@ class Formation(db.Model): """ e = dict(self.__dict__) e.pop("_sa_instance_state", None) - e.pop("referentiel_competence_id") if "referentiel_competence" in e: e.pop("referentiel_competence") e["departement"] = self.departement.to_dict() diff --git a/sco_version.py b/sco_version.py index 48027b23..5a42b639 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.4.18" +SCOVERSION = "9.4.19" SCONAME = "ScoDoc" diff --git a/tests/api/test_api_absences.py b/tests/api/test_api_absences.py index c57b3c1e..d64a7002 100644 --- a/tests/api/test_api_absences.py +++ b/tests/api/test_api_absences.py @@ -129,11 +129,8 @@ def test_abs_groupe_etat(api_headers): assert abs["begin"] < abs["end"] - all_unique = True - for id in list_id_etu: - if list_id_etu.count(id) > 1: - all_unique = False - assert all_unique is True + # vérifie que chaque étudiant n'apparait qu'une seule fois + assert len(set(list_id_etu)) == len(list_id_etu) date_debut = "Fri, 15 Apr 2021 00:00:00 GMT" date_fin = "Fri, 18 Apr 2022 00:00:00 GMT" diff --git a/tools/fakedatabase/create_test_api_database.py b/tools/fakedatabase/create_test_api_database.py index 996007c8..f62f4f72 100644 --- a/tools/fakedatabase/create_test_api_database.py +++ b/tools/fakedatabase/create_test_api_database.py @@ -164,12 +164,9 @@ def create_fake_etud(dept: Departement) -> Identite: etud.code_nip = f"{etud.id}" if (etud.id % 2) else f"NIP{etud.id}" etud.code_ine = f"INE{etud.id}" if (etud.id % 2) else f"{etud.id}" etud.date_naissance = datetime.date(2005, 2, 1) + datetime.timedelta(days=etud.id) + etud.adresse = [models.Adresse(email=f"{etud.prenom}.{etud.nom}@example.com")] db.session.add(etud) db.session.commit() - adresse = models.Adresse( - etudid=etud.id, email=f"{etud.prenom}.{etud.nom}@example.com" - ) - db.session.add(adresse) admission = models.Admission(etudid=etud.id) db.session.add(admission) db.session.commit()