mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-09 02:49:43 +00:00
Initial WS support (#2439)
* Initial WS support * test * Update frontend to fc7c4af2 * Fix issue with closing states * log error * make data optional * limit stopping states * Move wrappers to HomeAssistantWebSocket * use info * Use call_soon * Use lookuptable for WS commands * Fix tests
This commit is contained in:
@@ -6,6 +6,7 @@ from uuid import uuid4
|
||||
|
||||
from aiohttp import web
|
||||
from aiohttp.test_utils import TestClient
|
||||
from awesomeversion import AwesomeVersion
|
||||
import pytest
|
||||
|
||||
from supervisor.api import RestAPI
|
||||
@@ -20,6 +21,12 @@ from tests.common import exists_fixture, load_fixture, load_json_fixture
|
||||
# pylint: disable=redefined-outer-name, protected-access
|
||||
|
||||
|
||||
async def mock_async_return_true() -> bool:
|
||||
"""Mock methods to return True."""
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def docker() -> DockerAPI:
|
||||
"""Mock DockerAPI."""
|
||||
@@ -148,6 +155,12 @@ async def coresys(loop, docker, network_manager, aiohttp_client) -> CoreSys:
|
||||
coresys_obj.supervisor._connectivity = True
|
||||
coresys_obj.host.network._connectivity = True
|
||||
|
||||
# WebSocket
|
||||
coresys_obj.homeassistant.api.check_api_state = mock_async_return_true
|
||||
coresys_obj.homeassistant._websocket._client = AsyncMock(
|
||||
ha_version=AwesomeVersion("2021.2.4")
|
||||
)
|
||||
|
||||
yield coresys_obj
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user