Allow WS queue to temporarily peak (#34175)

* Allow WS queue to temporarily peak

* Remove unused code
This commit is contained in:
Paulus Schoutsen 2020-04-13 18:50:36 -07:00 committed by GitHub
parent dbcc294d67
commit bea354b82a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 116 additions and 34 deletions

View file

@ -2,19 +2,11 @@
from unittest.mock import Mock, patch
from aiohttp import WSMsgType
import pytest
import voluptuous as vol
from homeassistant.components.websocket_api import const, messages
@pytest.fixture
def mock_low_queue():
"""Mock a low queue."""
with patch("homeassistant.components.websocket_api.http.MAX_PENDING_MSG", 5):
yield
async def test_invalid_message_format(websocket_client):
"""Test sending invalid JSON."""
await websocket_client.send_json({"type": 5})
@ -46,14 +38,6 @@ async def test_quiting_hass(hass, websocket_client):
assert msg.type == WSMsgType.CLOSE
async def test_pending_msg_overflow(hass, mock_low_queue, websocket_client):
"""Test get_panels command."""
for idx in range(10):
await websocket_client.send_json({"id": idx + 1, "type": "ping"})
msg = await websocket_client.receive()
assert msg.type == WSMsgType.close
async def test_unknown_command(websocket_client):
"""Test get_panels command."""
await websocket_client.send_json({"id": 5, "type": "unknown_command"})