mirror of
https://github.com/home-assistant/core.git
synced 2025-07-30 02:38:10 +02:00
Find referenced floors in automations & scripts (#113802)
This commit is contained in:
@ -684,11 +684,14 @@ async def test_extraction_functions_not_setup(hass: HomeAssistant) -> None:
|
||||
assert script.devices_in_script(hass, "script.test") == []
|
||||
assert script.scripts_with_entity(hass, "light.in_both") == []
|
||||
assert script.entities_in_script(hass, "script.test") == []
|
||||
assert script.scripts_with_floor(hass, "floor-in-both") == []
|
||||
assert script.floors_in_script(hass, "script.test") == []
|
||||
|
||||
|
||||
async def test_extraction_functions_unknown_script(hass: HomeAssistant) -> None:
|
||||
"""Test extraction functions for an unknown script."""
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
assert script.floors_in_script(hass, "script.unknown") == []
|
||||
assert script.areas_in_script(hass, "script.unknown") == []
|
||||
assert script.blueprint_in_script(hass, "script.unknown") is None
|
||||
assert script.devices_in_script(hass, "script.unknown") == []
|
||||
@ -712,6 +715,8 @@ async def test_extraction_functions_unavailable_script(hass: HomeAssistant) -> N
|
||||
assert script.devices_in_script(hass, entity_id) == []
|
||||
assert script.scripts_with_entity(hass, "light.in_both") == []
|
||||
assert script.entities_in_script(hass, entity_id) == []
|
||||
assert script.scripts_with_floor(hass, "floor-in-both") == []
|
||||
assert script.floors_in_script(hass, entity_id) == []
|
||||
|
||||
|
||||
async def test_extraction_functions(
|
||||
@ -756,6 +761,10 @@ async def test_extraction_functions(
|
||||
"service": "test.test",
|
||||
"target": {"area_id": "area-in-both"},
|
||||
},
|
||||
{
|
||||
"service": "test.test",
|
||||
"target": {"floor_id": "floor-in-both"},
|
||||
},
|
||||
]
|
||||
},
|
||||
"test2": {
|
||||
@ -804,6 +813,14 @@ async def test_extraction_functions(
|
||||
"service": "test.test",
|
||||
"target": {"area_id": "area-in-last"},
|
||||
},
|
||||
{
|
||||
"service": "test.test",
|
||||
"target": {"floor_id": "floor-in-both"},
|
||||
},
|
||||
{
|
||||
"service": "test.test",
|
||||
"target": {"floor_id": "floor-in-last"},
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
@ -835,6 +852,14 @@ async def test_extraction_functions(
|
||||
"area-in-both",
|
||||
"area-in-last",
|
||||
}
|
||||
assert set(script.scripts_with_floor(hass, "floor-in-both")) == {
|
||||
"script.test1",
|
||||
"script.test3",
|
||||
}
|
||||
assert set(script.floors_in_script(hass, "script.test3")) == {
|
||||
"floor-in-both",
|
||||
"floor-in-last",
|
||||
}
|
||||
assert script.blueprint_in_script(hass, "script.test3") is None
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user