diff --git a/services/web/server/tests/unit/with_dbs/02/test_projects_crud_handlers.py b/services/web/server/tests/unit/with_dbs/02/test_projects_crud_handlers.py index 95a2671739b..971dcda8a20 100644 --- a/services/web/server/tests/unit/with_dbs/02/test_projects_crud_handlers.py +++ b/services/web/server/tests/unit/with_dbs/02/test_projects_crud_handlers.py @@ -4,7 +4,6 @@ # pylint: disable=unused-argument # pylint: disable=unused-variable -import re import uuid as uuidlib from collections.abc import Awaitable, Callable, Iterator from http import HTTPStatus @@ -16,9 +15,13 @@ from aiohttp.test_utils import TestClient from aioresponses import aioresponses from faker import Faker +from models_library.api_schemas_directorv2.dynamic_services import ( + GetProjectInactivityResponse, +) from models_library.products import ProductName from models_library.projects_state import ProjectState from pydantic import TypeAdapter +from pytest_mock import MockerFixture from pytest_simcore.helpers.assert_checks import assert_status from pytest_simcore.helpers.webserver_login import UserInfoDict from pytest_simcore.helpers.webserver_parametrizations import ( @@ -651,18 +654,10 @@ async def test_new_template_from_project( @pytest.fixture -def mock_director_v2_inactivity( - aioresponses_mocker: aioresponses, is_inactive: bool -) -> None: - aioresponses_mocker.clear() - get_services_pattern = re.compile( - r"^http://[a-z\-_]*director-v2:[0-9]+/v2/dynamic_services/projects/.*/inactivity.*$" - ) - aioresponses_mocker.get( - get_services_pattern, - status=status.HTTP_200_OK, - repeat=True, - payload={"is_inactive": is_inactive}, +def mock_dynamic_scheduler_inactivity(mocker: MockerFixture, is_inactive: bool) -> None: + mocker.patch( + "simcore_service_webserver.projects.projects_api.dynamic_scheduler_api.get_project_inactivity", + return_value=GetProjectInactivityResponse(is_inactive=is_inactive), ) @@ -675,7 +670,7 @@ def mock_director_v2_inactivity( ) @pytest.mark.parametrize("is_inactive", [True, False]) async def test_get_project_inactivity( - mock_director_v2_inactivity: None, + mock_dynamic_scheduler_inactivity: None, logged_user: UserInfoDict, client: TestClient, faker: Faker,