From 4688b7358f14e6635b844470fe9afc631c378ba8 Mon Sep 17 00:00:00 2001 From: Laurent LAPORTE Date: Tue, 14 Nov 2023 15:20:09 +0100 Subject: [PATCH] test(variant): correct unit test (foreign key constraint) --- tests/variantstudy/model/test_variant_model.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/variantstudy/model/test_variant_model.py b/tests/variantstudy/model/test_variant_model.py index 27cd732e47..89e4b96832 100644 --- a/tests/variantstudy/model/test_variant_model.py +++ b/tests/variantstudy/model/test_variant_model.py @@ -13,6 +13,7 @@ from antarest.core.requests import RequestParameters from antarest.core.roles import RoleType from antarest.core.utils.fastapi_sqlalchemy import DBSessionMiddleware, db +from antarest.login.model import User from antarest.study.model import DEFAULT_WORKSPACE_NAME, RawStudy, StudyAdditionalData from antarest.study.storage.variantstudy.command_factory import CommandFactory from antarest.study.storage.variantstudy.model.dbmodel import VariantStudy @@ -52,6 +53,9 @@ def test_commands_service(tmp_path: Path, db_engine: Engine, command_factory: Co ) with db(): + # Add the admin user in the database + db.session.add(User(id=SADMIN.user.id)) + # sourcery skip: extract-method, inline-variable # Save a study origin_id = "origin-id"