Skip to content

Commit 2e952ec

Browse files
committed
fixed test
1 parent 9821d1e commit 2e952ec

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

services/web/server/src/simcore_service_webserver/projects/_projects_service.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,14 +1620,15 @@ async def close_project_for_user(
16201620
task_suffix_name=f"remove_project_dynamic_services_{user_id=}_{project_uuid=}",
16211621
fire_and_forget_tasks_collection=app[APP_FIRE_AND_FORGET_TASKS_KEY],
16221622
)
1623-
# notify users that project is now closed
1624-
project = await get_project_for_user(
1625-
app,
1626-
f"{project_uuid}",
1627-
user_id,
1628-
include_state=True,
1629-
)
1630-
await notify_project_state_update(app, project)
1623+
else:
1624+
# when the project is still opened by other users, we just notify the project state update
1625+
project = await get_project_for_user(
1626+
app,
1627+
f"{project_uuid}",
1628+
user_id,
1629+
include_state=True,
1630+
)
1631+
await notify_project_state_update(app, project)
16311632

16321633

16331634
async def _get_project_share_state(

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ async def _assert_project_state_updated(
266266
async def _received_project_update_event() -> None:
267267
assert handler.call_count == len(
268268
expected_project_state_updates
269-
), f"got only {handler.call_count}/{len(expected_project_state_updates)} expected calls"
269+
), f"received {handler.call_count} of {len(expected_project_state_updates)} expected calls"
270270
if expected_project_state_updates:
271271
calls = [
272272
call(
@@ -1702,8 +1702,10 @@ async def test_open_shared_project_2_users_locked_remove_once_rtc_collaboration_
17021702
)
17031703

17041704
# we should receive an event that the project lock state changed
1705-
# NOTE: there are a total of 2x3 calls since we are part of the primary group and the all group and user 2 is part of the all group
1706-
# first CLOSING, then CLOSED (so 2 calls for user1 and 1 call for user2)
1705+
# NOTE: user 1 is part of the primary group owning the project, and the all group
1706+
# there will be an event when the project is CLOSING, then another once the services are removed and the project is CLOSED
1707+
# user 2 is only part of the all group, therefore only receives 1 event
1708+
17071709
await _assert_project_state_updated(
17081710
sio1_handlers[SOCKET_IO_PROJECT_UPDATED_EVENT],
17091711
shared_project,

0 commit comments

Comments
 (0)