mirror of
https://github.com/home-assistant/core.git
synced 2025-11-04 08:29:37 +00:00
Find referenced floors in automations & scripts (#113802)
This commit is contained in:
@@ -1561,6 +1561,8 @@ async def test_extraction_functions_not_setup(hass: HomeAssistant) -> None:
|
||||
assert automation.devices_in_automation(hass, "automation.test") == []
|
||||
assert automation.automations_with_entity(hass, "light.in_both") == []
|
||||
assert automation.entities_in_automation(hass, "automation.test") == []
|
||||
assert automation.automations_with_floor(hass, "floor-in-both") == []
|
||||
assert automation.floors_in_automation(hass, "automation.test") == []
|
||||
|
||||
|
||||
async def test_extraction_functions_unknown_automation(hass: HomeAssistant) -> None:
|
||||
@@ -1570,6 +1572,7 @@ async def test_extraction_functions_unknown_automation(hass: HomeAssistant) -> N
|
||||
assert automation.blueprint_in_automation(hass, "automation.unknown") is None
|
||||
assert automation.devices_in_automation(hass, "automation.unknown") == []
|
||||
assert automation.entities_in_automation(hass, "automation.unknown") == []
|
||||
assert automation.floors_in_automation(hass, "automation.unknown") == []
|
||||
|
||||
|
||||
async def test_extraction_functions_unavailable_automation(hass: HomeAssistant) -> None:
|
||||
@@ -1595,6 +1598,8 @@ async def test_extraction_functions_unavailable_automation(hass: HomeAssistant)
|
||||
assert automation.devices_in_automation(hass, entity_id) == []
|
||||
assert automation.automations_with_entity(hass, "light.in_both") == []
|
||||
assert automation.entities_in_automation(hass, entity_id) == []
|
||||
assert automation.automations_with_floor(hass, "floor-in-both") == []
|
||||
assert automation.floors_in_automation(hass, entity_id) == []
|
||||
|
||||
|
||||
async def test_extraction_functions(
|
||||
@@ -1694,6 +1699,10 @@ async def test_extraction_functions(
|
||||
"service": "test.test",
|
||||
"target": {"area_id": "area-in-both"},
|
||||
},
|
||||
{
|
||||
"service": "test.test",
|
||||
"target": {"floor_id": "floor-in-both"},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -1813,6 +1822,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"},
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
@@ -1855,6 +1872,14 @@ async def test_extraction_functions(
|
||||
"area-in-both",
|
||||
"area-in-last",
|
||||
}
|
||||
assert set(automation.automations_with_floor(hass, "floor-in-both")) == {
|
||||
"automation.test1",
|
||||
"automation.test3",
|
||||
}
|
||||
assert set(automation.floors_in_automation(hass, "automation.test3")) == {
|
||||
"floor-in-both",
|
||||
"floor-in-last",
|
||||
}
|
||||
assert automation.blueprint_in_automation(hass, "automation.test3") is None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user