Add base energy analytics (#53855)
This commit is contained in:
parent
bffa9f960d
commit
1c38e9168c
6 changed files with 106 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
"""Test the Energy websocket API."""
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.energy import data
|
||||
from homeassistant.components.energy import data, is_configured
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import flush_store
|
||||
|
@ -34,6 +34,8 @@ async def test_get_preferences_default(hass, hass_ws_client, hass_storage) -> No
|
|||
manager.data = data.EnergyManager.default_preferences()
|
||||
client = await hass_ws_client(hass)
|
||||
|
||||
assert not await is_configured(hass)
|
||||
|
||||
await client.send_json({"id": 5, "type": "energy/get_prefs"})
|
||||
|
||||
msg = await client.receive_json()
|
||||
|
@ -119,6 +121,8 @@ async def test_save_preferences(hass, hass_ws_client, hass_storage) -> None:
|
|||
|
||||
assert hass_storage[data.STORAGE_KEY]["data"] == new_prefs
|
||||
|
||||
assert await is_configured(hass)
|
||||
|
||||
# Verify info reflects data.
|
||||
await client.send_json({"id": 7, "type": "energy/info"})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue