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
46 changed files with 361 additions and 298 deletions

View File

@@ -178,7 +178,10 @@ async def test_setup_entry_not_ready(
async def test_entry_migration(
hass: HomeAssistant, v1_mock_config_entry: MockConfigEntry
hass: HomeAssistant,
device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry,
v1_mock_config_entry: MockConfigEntry,
) -> None:
"""Test entry migration from version 1 to 3, where host and port is required for the connection to the server."""
v1_mock_config_entry.add_to_hass(hass)
@@ -218,12 +221,10 @@ async def test_entry_migration(
assert migrated_config_entry.state == ConfigEntryState.LOADED
# Test migrated device entry.
device_registry = dr.async_get(hass)
device_entry = device_registry.async_get(device_entry_id)
assert device_entry.identifiers == {(DOMAIN, migrated_config_entry.entry_id)}
# Test migrated sensor entity entries.
entity_registry = er.async_get(hass)
for mapping in sensor_entity_id_key_mapping_list:
entity_entry = entity_registry.async_get(mapping["entity_id"])
assert (