Add nested light group test (#41764)

pull/41786/head
Franck Nijhof 2020-10-13 15:37:16 +02:00 committed by GitHub
parent 9877e8e25b
commit 64d3cdfb41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 36 additions and 0 deletions

View File

@ -764,5 +764,41 @@ async def test_reload_with_base_integration_platform_not_setup(hass):
assert hass.states.get("light.outside_patio_lights_g").state == STATE_OFF
async def test_nested_group(hass):
"""Test nested light group."""
hass.states.async_set("light.kitchen", "on")
await async_setup_component(
hass,
LIGHT_DOMAIN,
{
LIGHT_DOMAIN: [
{
"platform": DOMAIN,
"entities": ["light.bedroom_group"],
"name": "Nested Group",
},
{
"platform": DOMAIN,
"entities": ["light.kitchen", "light.bedroom"],
"name": "Bedroom Group",
},
]
},
)
await hass.async_block_till_done()
await hass.async_start()
await hass.async_block_till_done()
state = hass.states.get("light.bedroom_group")
assert state is not None
assert state.state == STATE_ON
assert state.attributes.get(ATTR_ENTITY_ID) == ["light.kitchen", "light.bedroom"]
state = hass.states.get("light.nested_group")
assert state is not None
assert state.state == STATE_ON
assert state.attributes.get(ATTR_ENTITY_ID) == ["light.bedroom_group"]
def _get_fixtures_base_path():
return path.dirname(path.dirname(path.dirname(__file__)))