Update m* tests to use entity & device registry fixtures (#103980)

This commit is contained in:
Jan-Philipp Benecke 2023-11-15 10:33:11 +01:00 committed by GitHub
parent 51c1ea85f3
commit 9326ea09a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 361 additions and 298 deletions

View file

@ -612,6 +612,8 @@ async def test_remove_entry(
@pytest.mark.parametrize("expected_lingering_tasks", [True])
async def test_remove_config_entry_device(
hass: HomeAssistant,
device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry,
matter_client: MagicMock,
hass_ws_client: WebSocketGenerator,
) -> None:
@ -621,11 +623,9 @@ async def test_remove_config_entry_device(
await hass.async_block_till_done()
config_entry = hass.config_entries.async_entries(DOMAIN)[0]
device_registry = dr.async_get(hass)
device_entry = dr.async_entries_for_config_entry(
device_registry, config_entry.entry_id
)[0]
entity_registry = er.async_get(hass)
entity_id = "light.m5stamp_lighting_app"
assert device_entry
@ -654,6 +654,7 @@ async def test_remove_config_entry_device(
@pytest.mark.parametrize("expected_lingering_tasks", [True])
async def test_remove_config_entry_device_no_node(
hass: HomeAssistant,
device_registry: dr.DeviceRegistry,
matter_client: MagicMock,
integration: MockConfigEntry,
hass_ws_client: WebSocketGenerator,
@ -661,7 +662,6 @@ async def test_remove_config_entry_device_no_node(
"""Test that a device can be removed ok without an existing node."""
assert await async_setup_component(hass, "config", {})
config_entry = integration
device_registry = dr.async_get(hass)
device_entry = device_registry.async_get_or_create(
config_entry_id=config_entry.entry_id,
identifiers={