mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Add list areas function to template (#88441)
This commit is contained in:
committed by
GitHub
parent
48fca3bb27
commit
eed16dc185
@@ -2851,6 +2851,26 @@ async def test_device_attr(
|
||||
assert info.rate_limit is None
|
||||
|
||||
|
||||
async def test_areas(hass: HomeAssistant, area_registry: ar.AreaRegistry) -> None:
|
||||
"""Test areas function."""
|
||||
# Test no areas
|
||||
info = render_to_info(hass, "{{ areas() }}")
|
||||
assert_result_info(info, [])
|
||||
assert info.rate_limit is None
|
||||
|
||||
# Test one area
|
||||
area1 = area_registry.async_get_or_create("area1")
|
||||
info = render_to_info(hass, "{{ areas() }}")
|
||||
assert_result_info(info, [area1.id])
|
||||
assert info.rate_limit is None
|
||||
|
||||
# Test multiple areas
|
||||
area2 = area_registry.async_get_or_create("area2")
|
||||
info = render_to_info(hass, "{{ areas() }}")
|
||||
assert_result_info(info, [area1.id, area2.id])
|
||||
assert info.rate_limit is None
|
||||
|
||||
|
||||
async def test_area_id(
|
||||
hass: HomeAssistant,
|
||||
area_registry: ar.AreaRegistry,
|
||||
|
||||
Reference in New Issue
Block a user