1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

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

@@ -89,6 +89,7 @@ from tests.common import MockConfigEntry
)
async def test_migrate_unique_id(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,
old_unique_id: str,
new_unique_id: str,
migration_needed: bool,
@@ -102,9 +103,7 @@ async def test_migrate_unique_id(
)
entry.add_to_hass(hass)
ent_reg = er.async_get(hass)
entity: er.RegistryEntry = ent_reg.async_get_or_create(
entity: er.RegistryEntry = entity_registry.async_get_or_create(
suggested_object_id="my_sensor",
disabled_by=None,
domain=SENSOR_DOMAIN,
@@ -118,9 +117,12 @@ async def test_migrate_unique_id(
await hass.async_block_till_done()
if migration_needed:
assert ent_reg.async_get_entity_id(SENSOR_DOMAIN, DOMAIN, old_unique_id) is None
assert (
entity_registry.async_get_entity_id(SENSOR_DOMAIN, DOMAIN, old_unique_id)
is None
)
assert (
ent_reg.async_get_entity_id(SENSOR_DOMAIN, DOMAIN, new_unique_id)
entity_registry.async_get_entity_id(SENSOR_DOMAIN, DOMAIN, new_unique_id)
== "sensor.my_sensor"
)