Fix Lovelace resources health info (#33309)

* Fix Lovelace resources health info

* Fix tests
This commit is contained in:
Bram Kragten authored and GitHub committed 2020-03-28 13:57:36 +01:00
1 parent 4a2236fe85
commit 1477087c71
4 files changed
+22 -6

No files matched your search

+5 -3
View File
@@ -165,7 +165,7 @@ async def test_system_health_info_autogen(hass):
"""Test system health info endpoint."""
assert await async_setup_component(hass, "lovelace", {})
info = await get_system_health_info(hass, "lovelace")
assert info == {"mode": "auto-gen"}
assert info == {"dashboards": 1, "mode": "auto-gen", "resources": 0}
async def test_system_health_info_storage(hass, hass_storage):
@@ -177,7 +177,7 @@ async def test_system_health_info_storage(hass, hass_storage):
}
assert await async_setup_component(hass, "lovelace", {})
info = await get_system_health_info(hass, "lovelace")
assert info == {"mode": "storage", "resources": 0, "views": 0}
assert info == {"dashboards": 1, "mode": "storage", "resources": 0, "views": 0}
async def test_system_health_info_yaml(hass):
@@ -188,7 +188,7 @@ async def test_system_health_info_yaml(hass):
return_value={"views": [{"cards": []}]},
):
info = await get_system_health_info(hass, "lovelace")
assert info == {"mode": "yaml", "resources": 0, "views": 1}
assert info == {"dashboards": 1, "mode": "yaml", "resources": 0, "views": 1}
async def test_system_health_info_yaml_not_found(hass):
@@ -196,8 +196,10 @@ async def test_system_health_info_yaml_not_found(hass):
assert await async_setup_component(hass, "lovelace", {"lovelace": {"mode": "YAML"}})
info = await get_system_health_info(hass, "lovelace")
assert info == {
"dashboards": 1,
"mode": "yaml",
"error": "{} not found".format(hass.config.path("ui-lovelace.yaml")),
"resources": 0,
}