Skip to content

Commit be0be01

Browse files
committed
cleanup
1 parent 0c49896 commit be0be01

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

services/web/server/tests/integration/01/test_garbage_collection.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from collections.abc import AsyncIterable, Awaitable, Callable
99
from copy import deepcopy
1010
from pathlib import Path
11-
from typing import Any
11+
from typing import Any, NamedTuple
1212
from unittest import mock
1313
from uuid import UUID, uuid4
1414

@@ -303,13 +303,19 @@ async def change_user_role(
303303
)
304304

305305

306+
class SioConnectionData(NamedTuple):
307+
sio: socketio.AsyncClient
308+
resource_key: UserSessionDict
309+
310+
306311
async def connect_to_socketio(
307312
client: TestClient,
308313
user,
309314
socketio_client_factory: Callable[..., Awaitable[socketio.AsyncClient]],
310-
):
315+
) -> SioConnectionData:
311316
"""Connect a user to a socket.io"""
312-
socket_registry = get_registry(client.server.app)
317+
assert client.app
318+
socket_registry = get_registry(client.app)
313319
cur_client_session_id = f"{uuid4()}"
314320
sio = await socketio_client_factory(cur_client_session_id, client)
315321
resource_key: UserSessionDict = {
@@ -323,11 +329,11 @@ async def connect_to_socketio(
323329
resource_key, "socket_id"
324330
)
325331
assert len(await socket_registry.find_resources(resource_key, "socket_id")) == 1
326-
return sio, resource_key
332+
return SioConnectionData(sio, resource_key)
327333

328334

329335
async def disconnect_user_from_socketio(
330-
client: TestClient, sio_connection_data
336+
client: TestClient, sio_connection_data: SioConnectionData
331337
) -> None:
332338
"""disconnect a previously connected socket.io connection"""
333339
sio, resource_key = sio_connection_data

0 commit comments

Comments
 (0)