async def test_emit_with_result_timeout(client: NetworkClient): # Setup client._connection_state = ConnectionState.Connected client.sio = AsyncMock() client.sio.call.side_effect = socketio.exceptions.TimeoutError() # Run with pytest.raises(RequestTimeout, match="Timeout after "): await client._emit_with_result("test_event")
async def test_on_connect_restore_timeout(client: NetworkClient): # Setup client._restore_session = AsyncMock(side_effect=ServerError()) client._connection_state = ConnectionState.Connecting client.disconnect_from_server = AsyncMock() # Run await client.on_connect() # Assert assert client.connection_state == ConnectionState.Disconnected client.disconnect_from_server.assert_awaited_once_with()