Skip to content

Commit df9a07c

Browse files
committed
test: assert ws_client cleanup behavior, not just retry count
1 parent ab8a27c commit df9a07c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/test_connection_manager.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,13 @@ async def test_cleans_up_ws_client_between_retries(self, connection_manager):
127127
cm = connection_manager
128128
call_count = 0
129129

130+
first_ws_client = MagicMock()
131+
130132
async def mock_connect_internal(migrating_from_list=None, **kwargs):
131133
nonlocal call_count
132134
call_count += 1
133135
if call_count == 1:
134-
cm._ws_client = MagicMock()
136+
cm._ws_client = first_ws_client
135137
mock_join_response = MagicMock()
136138
mock_join_response.credentials.server.edge_name = "sfu-node-1"
137139
cm.join_response = mock_join_response
@@ -147,3 +149,5 @@ async def mock_connect_internal(migrating_from_list=None, **kwargs):
147149
await cm.connect()
148150

149151
assert call_count == 2
152+
first_ws_client.close.assert_called_once()
153+
assert cm._ws_client is None

0 commit comments

Comments
 (0)