Add frontend version WS command (#34701)
This commit is contained in:
1 parent
17c31ed640
commit
86ae02e5c5
2 files changed
+45
-13
No files matched your search
@@ -14,6 +14,7 @@ from homeassistant.components.frontend import (
|
||||
)
|
||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.const import HTTP_NOT_FOUND
|
||||
from homeassistant.loader import async_get_integration
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import async_capture_events
|
||||
@@ -336,3 +337,24 @@ async def test_auth_authorize(mock_http_client):
|
||||
resp = await mock_http_client.get(authorizejs.groups(0)[0])
|
||||
assert resp.status == 200
|
||||
assert "public" in resp.headers.get("cache-control")
|
||||
|
||||
|
||||
async def test_get_version(hass, hass_ws_client):
|
||||
"""Test get_version command."""
|
||||
frontend = await async_get_integration(hass, "frontend")
|
||||
cur_version = next(
|
||||
req.split("==", 1)[1]
|
||||
for req in frontend.requirements
|
||||
if req.startswith("home-assistant-frontend==")
|
||||
)
|
||||
|
||||
await async_setup_component(hass, "frontend", {})
|
||||
client = await hass_ws_client(hass)
|
||||
|
||||
await client.send_json({"id": 5, "type": "frontend/get_version"})
|
||||
msg = await client.receive_json()
|
||||
|
||||
assert msg["id"] == 5
|
||||
assert msg["type"] == TYPE_RESULT
|
||||
assert msg["success"]
|
||||
assert msg["result"] == {"version": cur_version}
|
||||
Reference in new issue
Block a user