From ab44af53867f6862028a00c4da9c0b26dec1e7e1 Mon Sep 17 00:00:00 2001 From: TLAIDI Date: Fri, 28 Jul 2023 15:13:42 +0200 Subject: [PATCH] fix(api): fix failed tests (#1646) --- tests/storage/integration/test_exporter.py | 1 + tests/variantstudy/model/test_variant_model.py | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/storage/integration/test_exporter.py b/tests/storage/integration/test_exporter.py index be3d5c5c9f..2ab14e26c2 100644 --- a/tests/storage/integration/test_exporter.py +++ b/tests/storage/integration/test_exporter.py @@ -118,6 +118,7 @@ def test_export_flat( export_study_flat( path_studies / "STA-mini", export_path / "STA-mini-export", + Mock(), outputs, output_list, ) diff --git a/tests/variantstudy/model/test_variant_model.py b/tests/variantstudy/model/test_variant_model.py index d1cebd2ce9..3b2a66c4f5 100644 --- a/tests/variantstudy/model/test_variant_model.py +++ b/tests/variantstudy/model/test_variant_model.py @@ -13,6 +13,7 @@ from antarest.core.utils.fastapi_sqlalchemy import DBSessionMiddleware, db 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 from antarest.study.storage.variantstudy.model.model import CommandDTO, GenerationResultInfoDTO from antarest.study.storage.variantstudy.repository import VariantStudyRepository from antarest.study.storage.variantstudy.variant_study_service import SNAPSHOT_RELATIVE_PATH, VariantStudyService @@ -28,7 +29,12 @@ ) -def test_commands_service(tmp_path: Path, command_factory: CommandFactory): +@patch( + "antarest.study.storage.variantstudy.variant_study_service.export_study_flat" +) +def test_commands_service( + mock_export, tmp_path: Path, command_factory: CommandFactory +): engine = create_engine( "sqlite:///:memory:", echo=False, @@ -41,6 +47,7 @@ def test_commands_service(tmp_path: Path, command_factory: CommandFactory): custom_engine=engine, session_args={"autocommit": False, "autoflush": False}, ) + repository = VariantStudyRepository(LocalCache()) service = VariantStudyService( raw_study_service=Mock(), @@ -176,6 +183,7 @@ def test_smart_generation(mock_export, tmp_path: Path, command_factory: CommandF def export_flat( path_study: Path, dest: Path, + study_factory: VariantStudy, outputs: bool = True, denormalize: bool = True, ) -> None: