From 0ae453c8274d08d059f5452c58b1e2c46cc98d50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Thu, 17 Oct 2024 13:46:22 +0200 Subject: [PATCH] Stronger test --- geoportal/tests/functional/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/geoportal/tests/functional/__init__.py b/geoportal/tests/functional/__init__.py index 73cdd7eb58..855e0dbf1e 100644 --- a/geoportal/tests/functional/__init__.py +++ b/geoportal/tests/functional/__init__.py @@ -112,7 +112,10 @@ def setup_db() -> None: from c2cgeoportal_commons.models.main import Role with DBSession() as session: - session.add_all([Role(name) for name in ("anonymous", "registered", "intranet")]) + for role_name in ("anonymous", "registered", "intranet"): + role = session.query(Role).filter(Role.name == role_name).one_or_none() + if role is None: + session.add(Role(name=role_name)) transaction.commit()