Add base energy analytics (#53855)

This commit is contained in:
Joakim Sørensen 2021-08-02 18:46:07 +02:00 committed by GitHub
parent bffa9f960d
commit 1c38e9168c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 106 additions and 4 deletions

View file

@ -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"})