Skip to content

Commit

Permalink
Stronger test
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Dec 3, 2024
1 parent 1bc47d6 commit 0ae453c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion geoportal/tests/functional/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 0ae453c

Please sign in to comment.