From 64d3cdfb41544af32f32385aad1b385669f43d3e Mon Sep 17 00:00:00 2001 From: Franck Nijhof <git@frenck.dev> Date: Tue, 13 Oct 2020 15:37:16 +0200 Subject: [PATCH] Add nested light group test (#41764) --- tests/components/group/test_light.py | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/components/group/test_light.py b/tests/components/group/test_light.py index ba8fecbed32..8ce9f4bf9f3 100644 --- a/tests/components/group/test_light.py +++ b/tests/components/group/test_light.py @@ -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__))) -- GitLab