Use registry fixtures in tests (z) (#118300)

This commit is contained in:
epenet 2024-05-28 18:25:49 +02:00 committed by GitHub
parent 106cb4cfb7
commit 0b2aac8f4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 526 additions and 372 deletions

View file

@ -1601,7 +1601,12 @@ async def async_test_flash_from_hass(hass, cluster, entity_id, flash):
new=0,
)
async def test_zha_group_light_entity(
hass: HomeAssistant, device_light_1, device_light_2, device_light_3, coordinator
hass: HomeAssistant,
entity_registry: er.EntityRegistry,
device_light_1,
device_light_2,
device_light_3,
coordinator,
) -> None:
"""Test the light entity for a ZHA group."""
zha_gateway = get_zha_gateway(hass)
@ -1782,7 +1787,6 @@ async def test_zha_group_light_entity(
assert device_3_entity_id not in zha_group.member_entity_ids
# make sure the entity registry entry is still there
entity_registry = er.async_get(hass)
assert entity_registry.async_get(group_entity_id) is not None
# add a member back and ensure that the group entity was created again
@ -1829,6 +1833,7 @@ async def test_zha_group_light_entity(
)
async def test_group_member_assume_state(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,
zigpy_device_mock,
zha_device_joined,
coordinator,
@ -1916,7 +1921,6 @@ async def test_group_member_assume_state(
assert hass.states.get(group_entity_id).state == STATE_OFF
# remove the group and ensure that there is no entity and that the entity registry is cleaned up
entity_registry = er.async_get(hass)
assert entity_registry.async_get(group_entity_id) is not None
await zha_gateway.async_remove_zigpy_group(zha_group.group_id)
assert hass.states.get(group_entity_id) is None