Skip to content

Commit c92eb97

Browse files
fix test
1 parent 4f7edeb commit c92eb97

File tree

3 files changed

+48
-23
lines changed

3 files changed

+48
-23
lines changed

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import pytest
1717
from aiohttp.test_utils import TestClient
1818
from aioresponses import aioresponses
19+
from common_library.json_serialization import json_dumps
1920
from faker import Faker
2021
from models_library.api_schemas_directorv2.dynamic_services import DynamicServiceGet
2122
from models_library.projects_nodes import Node, NodeID
@@ -27,6 +28,8 @@
2728
from pydantic import TypeAdapter
2829
from pytest_mock import MockerFixture
2930
from pytest_simcore.helpers.assert_checks import assert_status
31+
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
32+
from pytest_simcore.helpers.typing_env import EnvVarsDict
3033
from pytest_simcore.helpers.webserver_projects import NewProject, delete_all_projects
3134
from pytest_simcore.helpers.webserver_users import UserInfoDict
3235
from settings_library.catalog import CatalogSettings
@@ -483,3 +486,25 @@ def workbench_db_column() -> dict[str, Any]:
483486
def workbench(workbench_db_column: dict[str, Any]) -> dict[NodeID, Node]:
484487
# convert to model
485488
return TypeAdapter(dict[NodeID, Node]).validate_python(workbench_db_column)
489+
490+
491+
@pytest.fixture
492+
def max_number_of_user_sessions(faker: Faker) -> int:
493+
return faker.pyint(min_value=1, max_value=5)
494+
495+
496+
@pytest.fixture
497+
def with_enabled_rtc_collaboration(
498+
app_environment: EnvVarsDict,
499+
with_dev_features_enabled: None,
500+
monkeypatch: pytest.MonkeyPatch,
501+
max_number_of_user_sessions: int,
502+
) -> None:
503+
setenvs_from_dict(
504+
monkeypatch,
505+
{
506+
"WEBSERVER_REALTIME_COLLABORATION": json_dumps(
507+
{"RTC_MAX_NUMBER_OF_USERS": max_number_of_user_sessions}
508+
)
509+
},
510+
)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def user_primary_gid(logged_user: UserInfoDict) -> int:
4949
)
5050
async def test_patch_project_and_notify_users_sequential(
5151
user_role: UserRole,
52+
with_enabled_rtc_collaboration: None,
5253
expected: HTTPStatus,
5354
client: TestClient,
5455
user_project: ProjectDict,
@@ -105,6 +106,7 @@ async def test_patch_project_and_notify_users_sequential(
105106
)
106107
async def test_patch_project_and_notify_users_concurrent_locking(
107108
user_role: UserRole,
109+
with_enabled_rtc_collaboration: None,
108110
expected: HTTPStatus,
109111
client: TestClient,
110112
user_project: ProjectDict,
@@ -155,6 +157,7 @@ async def test_patch_project_and_notify_users_concurrent_locking(
155157
)
156158
async def test_patch_project_and_notify_users_concurrent_different_projects(
157159
user_role: UserRole,
160+
with_enabled_rtc_collaboration: None,
158161
expected: HTTPStatus,
159162
client: TestClient,
160163
user_project: ProjectDict,

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

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import sqlalchemy as sa
2323
from aiohttp import ClientResponse
2424
from aiohttp.test_utils import TestClient, TestServer
25-
from common_library.json_serialization import json_dumps
2625
from faker import Faker
2726
from models_library.api_schemas_directorv2.dynamic_services import DynamicServiceGet
2827
from models_library.api_schemas_dynamic_scheduler.dynamic_services import (
@@ -54,8 +53,6 @@
5453
from pytest_mock import MockerFixture
5554
from pytest_simcore.helpers.assert_checks import assert_status
5655
from pytest_simcore.helpers.logging_tools import log_context
57-
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
58-
from pytest_simcore.helpers.typing_env import EnvVarsDict
5956
from pytest_simcore.helpers.webserver_login import LoggedUser, log_client_in
6057
from pytest_simcore.helpers.webserver_parametrizations import (
6158
ExpectedResponse,
@@ -88,26 +85,26 @@
8885
API_PREFIX = f"/{API_VTAG}"
8986

9087

91-
@pytest.fixture
92-
def max_number_of_user_sessions(faker: Faker) -> int:
93-
return faker.pyint(min_value=1, max_value=5)
94-
95-
96-
@pytest.fixture
97-
def with_enabled_rtc_collaboration(
98-
app_environment: EnvVarsDict,
99-
with_dev_features_enabled: None,
100-
monkeypatch: pytest.MonkeyPatch,
101-
max_number_of_user_sessions: int,
102-
) -> None:
103-
setenvs_from_dict(
104-
monkeypatch,
105-
{
106-
"WEBSERVER_REALTIME_COLLABORATION": json_dumps(
107-
{"RTC_MAX_NUMBER_OF_USERS": max_number_of_user_sessions}
108-
)
109-
},
110-
)
88+
# @pytest.fixture
89+
# def max_number_of_user_sessions(faker: Faker) -> int:
90+
# return faker.pyint(min_value=1, max_value=5)
91+
92+
93+
# @pytest.fixture
94+
# def with_enabled_rtc_collaboration(
95+
# app_environment: EnvVarsDict,
96+
# with_dev_features_enabled: None,
97+
# monkeypatch: pytest.MonkeyPatch,
98+
# max_number_of_user_sessions: int,
99+
# ) -> None:
100+
# setenvs_from_dict(
101+
# monkeypatch,
102+
# {
103+
# "WEBSERVER_REALTIME_COLLABORATION": json_dumps(
104+
# {"RTC_MAX_NUMBER_OF_USERS": max_number_of_user_sessions}
105+
# )
106+
# },
107+
# )
111108

112109

113110
def assert_replaced(current_project, update_data):

0 commit comments

Comments
 (0)