Allow WS queue to temporarily peak (#34175)
* Allow WS queue to temporarily peak * Remove unused code
This commit is contained in:
parent
dbcc294d67
commit
bea354b82a
6 changed files with 116 additions and 34 deletions
|
@ -7,23 +7,23 @@ from homeassistant.setup import async_setup_component
|
|||
|
||||
|
||||
@pytest.fixture
|
||||
def websocket_client(hass, hass_ws_client, hass_access_token):
|
||||
async def websocket_client(hass, hass_ws_client):
|
||||
"""Create a websocket client."""
|
||||
return hass.loop.run_until_complete(hass_ws_client(hass, hass_access_token))
|
||||
return await hass_ws_client(hass)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def no_auth_websocket_client(hass, loop, aiohttp_client):
|
||||
async def no_auth_websocket_client(hass, aiohttp_client):
|
||||
"""Websocket connection that requires authentication."""
|
||||
assert loop.run_until_complete(async_setup_component(hass, "websocket_api", {}))
|
||||
assert await async_setup_component(hass, "websocket_api", {})
|
||||
|
||||
client = loop.run_until_complete(aiohttp_client(hass.http.app))
|
||||
ws = loop.run_until_complete(client.ws_connect(URL))
|
||||
client = await aiohttp_client(hass.http.app)
|
||||
ws = await client.ws_connect(URL)
|
||||
|
||||
auth_ok = loop.run_until_complete(ws.receive_json())
|
||||
auth_ok = await ws.receive_json()
|
||||
assert auth_ok["type"] == TYPE_AUTH_REQUIRED
|
||||
|
||||
yield ws
|
||||
|
||||
if not ws.closed:
|
||||
loop.run_until_complete(ws.close())
|
||||
await ws.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue