Skip to content

Commit e24dd63

Browse files
committed
using fixtures
1 parent 5f587f3 commit e24dd63

File tree

2 files changed

+16
-24
lines changed

2 files changed

+16
-24
lines changed

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,20 @@ def max_number_of_user_sessions(faker: Faker) -> int:
493493
return faker.pyint(min_value=1, max_value=5)
494494

495495

496+
@pytest.fixture
497+
def with_disabled_rtc_collaboration(
498+
app_environment: EnvVarsDict, # ensure pre-app startup envs
499+
monkeypatch: pytest.MonkeyPatch,
500+
) -> None:
501+
setenvs_from_dict(
502+
monkeypatch,
503+
{"WEBSERVER_REALTIME_COLLABORATION": "null"},
504+
)
505+
506+
496507
@pytest.fixture
497508
def with_enabled_rtc_collaboration(
498-
app_environment: EnvVarsDict,
499-
with_dev_features_enabled: None,
509+
app_environment: EnvVarsDict, # ensure pre-app startup envs
500510
monkeypatch: pytest.MonkeyPatch,
501511
max_number_of_user_sessions: int,
502512
) -> None:
@@ -512,8 +522,7 @@ def with_enabled_rtc_collaboration(
512522

513523
@pytest.fixture
514524
def with_enabled_rtc_collaboration_limited_to_1_user(
515-
app_environment: EnvVarsDict,
516-
with_dev_features_enabled: None,
525+
app_environment: EnvVarsDict, # ensure pre-app startup envs
517526
monkeypatch: pytest.MonkeyPatch,
518527
) -> None:
519528
setenvs_from_dict(

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

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
from simcore_postgres_database.models.products import products
6868
from simcore_postgres_database.models.wallets import wallets
6969
from simcore_service_webserver._meta import API_VTAG
70-
from simcore_service_webserver.application_settings import get_application_settings
7170
from simcore_service_webserver.db.models import UserRole
7271
from simcore_service_webserver.projects.models import ProjectDict
7372
from simcore_service_webserver.socketio.messages import SOCKET_IO_PROJECT_UPDATED_EVENT
@@ -1152,6 +1151,7 @@ async def test_close_project(
11521151
],
11531152
)
11541153
async def test_get_active_project(
1154+
with_disabled_rtc_collaboration: None,
11551155
client: TestClient,
11561156
logged_user: UserInfoDict,
11571157
user_project: ProjectDict,
@@ -1199,25 +1199,7 @@ async def test_get_active_project(
11991199
client.app, ProjectID(user_project["uuid"])
12001200
)
12011201
assert not error
1202-
1203-
# The realtime collaboration feature unlocks the projects since they can be edited by multiple users simultaneously
1204-
realtime_collaboration_settings = get_application_settings(
1205-
client.app
1206-
).WEBSERVER_REALTIME_COLLABORATION
1207-
realtime_collaboration_enabled = (
1208-
realtime_collaboration_settings
1209-
and realtime_collaboration_settings.RTC_MAX_NUMBER_OF_USERS
1210-
and realtime_collaboration_settings.RTC_MAX_NUMBER_OF_USERS > 1
1211-
)
1212-
1213-
share_state_locked = ProjectStateOutputSchema(
1214-
**data.pop("state")
1215-
).share_state.locked
1216-
assert (
1217-
not share_state_locked
1218-
if realtime_collaboration_enabled
1219-
else share_state_locked
1220-
)
1202+
assert ProjectStateOutputSchema(**data.pop("state")).share_state.locked
12211203
data.pop("folderId")
12221204

12231205
user_project_last_change_date = user_project.pop("lastChangeDate")
@@ -1815,6 +1797,7 @@ async def test_closing_and_reopening_tab_of_opened_project_multiple_users(
18151797

18161798
@pytest.mark.parametrize(*standard_user_role_response())
18171799
async def test_open_shared_project_2_users_locked_remove_once_rtc_collaboration_is_defaulted(
1800+
with_disabled_rtc_collaboration: None,
18181801
client: TestClient,
18191802
client_on_running_server_factory: Callable[[], TestClient],
18201803
logged_user: dict,

0 commit comments

Comments
 (0)