mirror of
https://github.com/home-assistant/core
synced 2024-09-06 10:29:55 +02:00
Fix issue when data is None (#53875)
This commit is contained in:
parent
3bf06de363
commit
c3d623a37e
@ -14,6 +14,8 @@ from .data import async_get_manager
|
||||
async def is_configured(hass: HomeAssistant) -> bool:
|
||||
"""Return a boolean to indicate if energy is configured."""
|
||||
manager = await async_get_manager(hass)
|
||||
if manager.data is None:
|
||||
return False
|
||||
return bool(manager.data != manager.default_preferences())
|
||||
|
||||
|
||||
|
@ -30,6 +30,7 @@ async def test_get_preferences_no_data(hass, hass_ws_client) -> None:
|
||||
|
||||
async def test_get_preferences_default(hass, hass_ws_client, hass_storage) -> None:
|
||||
"""Test we get preferences."""
|
||||
assert not await is_configured(hass)
|
||||
manager = await data.async_get_manager(hass)
|
||||
manager.data = data.EnergyManager.default_preferences()
|
||||
client = await hass_ws_client(hass)
|
||||
|
Loading…
Reference in New Issue
Block a user