mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 04:50:05 +00:00
Fix websocket api reaching queue (#7590)
* Fix websocket api reaching queue * Fix outside task message sending * Fix Py34 tests
This commit is contained in:
@@ -50,6 +50,13 @@ def no_auth_websocket_client(hass, loop, test_client):
|
||||
loop.run_until_complete(ws.close())
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_low_queue():
|
||||
"""Mock a low queue."""
|
||||
with patch.object(wapi, 'MAX_PENDING_MSG', 5):
|
||||
yield
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_auth_via_msg(no_auth_websocket_client):
|
||||
"""Test authenticating."""
|
||||
@@ -304,3 +311,15 @@ def test_ping(websocket_client):
|
||||
msg = yield from websocket_client.receive_json()
|
||||
assert msg['id'] == 5
|
||||
assert msg['type'] == wapi.TYPE_PONG
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_pending_msg_overflow(hass, mock_low_queue, websocket_client):
|
||||
"""Test get_panels command."""
|
||||
for idx in range(10):
|
||||
websocket_client.send_json({
|
||||
'id': idx + 1,
|
||||
'type': wapi.TYPE_PING,
|
||||
})
|
||||
msg = yield from websocket_client.receive()
|
||||
assert msg.type == WSMsgType.close
|
||||
|
||||
Reference in New Issue
Block a user