Entity Component to no longer generate automatic groups (#23789)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2020-01-07 17:30:53 +01:00
1 parent 13e6479b6e
commit 9aa02e35a7
41 files changed
+149 -377

No files matched your search

+1 -34
View File
@@ -31,39 +31,6 @@ _LOGGER = logging.getLogger(__name__)
DOMAIN = "test_domain"
async def test_setting_up_group(hass):
"""Set up the setting of a group."""
assert await async_setup_component(hass, "group", {"group": {}})
component = EntityComponent(_LOGGER, DOMAIN, hass, group_name="everyone")
# No group after setup
assert len(hass.states.async_entity_ids()) == 0
await component.async_add_entities([MockEntity()])
await hass.async_block_till_done()
# group exists
assert len(hass.states.async_entity_ids()) == 2
assert hass.states.async_entity_ids("group") == ["group.everyone"]
grp = hass.states.get("group.everyone")
assert grp.attributes.get("entity_id") == ("test_domain.unnamed_device",)
# group extended
await component.async_add_entities([MockEntity(name="goodbye")])
await hass.async_block_till_done()
assert len(hass.states.async_entity_ids()) == 3
grp = hass.states.get("group.everyone")
# Ordered in order of added to the group
assert grp.attributes.get("entity_id") == (
"test_domain.goodbye",
"test_domain.unnamed_device",
)
async def test_setup_loads_platforms(hass):
"""Test the loading of the platforms."""
component_setup = Mock(return_value=True)
@@ -424,7 +391,7 @@ async def test_set_service_race(hass):
hass.loop.set_exception_handler(async_loop_exception_handler)
await async_setup_component(hass, "group", {})
component = EntityComponent(_LOGGER, DOMAIN, hass, group_name="yo")
component = EntityComponent(_LOGGER, DOMAIN, hass)
for _ in range(2):
hass.async_create_task(component.async_add_entities([MockEntity()]))