Skip to content

Commit 5c36635

Browse files
author
Andrei Neagu
committed
unblocking hanging tests
1 parent 7281f23 commit 5c36635

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

services/web/server/tests/unit/with_dbs/02/conftest.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
from aiohttp.test_utils import TestClient
1818
from aioresponses import aioresponses
1919
from faker import Faker
20-
from models_library.api_schemas_directorv2.dynamic_services import DynamicServiceGet
20+
from models_library.api_schemas_directorv2.dynamic_services import (
21+
DynamicServiceGet,
22+
GetProjectInactivityResponse,
23+
)
2124
from models_library.projects_nodes import Node, NodeID
2225
from models_library.projects_state import ProjectState
2326
from models_library.services_resources import (
@@ -264,9 +267,19 @@ async def _assert_it(
264267
return _assert_it
265268

266269

270+
@pytest.fixture
271+
def disable_dynamic_scheduler_inactivity(mocker: MockerFixture) -> None:
272+
mocker.patch(
273+
"simcore_service_webserver.projects.projects_api.dynamic_scheduler_api.get_project_inactivity",
274+
return_value=GetProjectInactivityResponse(is_inactive=True),
275+
)
276+
277+
267278
@pytest.fixture
268279
def app_environment(
269-
app_environment: EnvVarsDict, monkeypatch: pytest.MonkeyPatch
280+
app_environment: EnvVarsDict,
281+
monkeypatch: pytest.MonkeyPatch,
282+
disable_dynamic_scheduler_inactivity: None,
270283
) -> EnvVarsDict:
271284
envs_plugins = setenvs_from_dict(
272285
monkeypatch,

services/web/server/tests/unit/with_dbs/02/test_projects_crud_handlers.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,9 @@
1515
from aiohttp.test_utils import TestClient
1616
from aioresponses import aioresponses
1717
from faker import Faker
18-
from models_library.api_schemas_directorv2.dynamic_services import (
19-
GetProjectInactivityResponse,
20-
)
2118
from models_library.products import ProductName
2219
from models_library.projects_state import ProjectState
2320
from pydantic import TypeAdapter
24-
from pytest_mock import MockerFixture
2521
from pytest_simcore.helpers.assert_checks import assert_status
2622
from pytest_simcore.helpers.webserver_login import UserInfoDict
2723
from pytest_simcore.helpers.webserver_parametrizations import (
@@ -658,30 +654,19 @@ async def test_new_template_from_project(
658654
TypeAdapter(uuidlib.UUID).validate_python(node_name)
659655

660656

661-
@pytest.fixture
662-
def mock_dynamic_scheduler_inactivity(mocker: MockerFixture, is_inactive: bool) -> None:
663-
mocker.patch(
664-
"simcore_service_webserver.projects.projects_api.dynamic_scheduler_api.get_project_inactivity",
665-
return_value=GetProjectInactivityResponse(is_inactive=is_inactive),
666-
)
667-
668-
669657
@pytest.mark.parametrize(
670658
"user_role,expected",
671659
[
672660
(UserRole.ANONYMOUS, status.HTTP_401_UNAUTHORIZED),
673661
*((role, status.HTTP_200_OK) for role in UserRole if role > UserRole.ANONYMOUS),
674662
],
675663
)
676-
@pytest.mark.parametrize("is_inactive", [True, False])
677664
async def test_get_project_inactivity(
678-
mock_dynamic_scheduler_inactivity: None,
679665
logged_user: UserInfoDict,
680666
client: TestClient,
681667
faker: Faker,
682668
user_role: UserRole,
683669
expected: HTTPStatus,
684-
is_inactive: bool,
685670
):
686671
mock_project_id = faker.uuid4()
687672

@@ -697,4 +682,4 @@ async def test_get_project_inactivity(
697682

698683
assert data
699684
assert error is None
700-
assert data["is_inactive"] is is_inactive
685+
assert data["is_inactive"] is True

0 commit comments

Comments
 (0)