Update tests c-h to use registry async_get (#47652)
This commit is contained in:
parent
ba2978c693
commit
87e7cebd36
49 changed files with 165 additions and 138 deletions
|
@ -1,7 +1,7 @@
|
|||
"""Test init of Logitch Harmony Hub integration."""
|
||||
from homeassistant.components.harmony.const import DOMAIN
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||
from homeassistant.helpers import entity_registry
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .const import (
|
||||
|
@ -28,28 +28,28 @@ async def test_unique_id_migration(mock_hc, hass, mock_write_config):
|
|||
hass,
|
||||
{
|
||||
# old format
|
||||
ENTITY_WATCH_TV: entity_registry.RegistryEntry(
|
||||
ENTITY_WATCH_TV: er.RegistryEntry(
|
||||
entity_id=ENTITY_WATCH_TV,
|
||||
unique_id="123443-Watch TV",
|
||||
platform="harmony",
|
||||
config_entry_id=entry.entry_id,
|
||||
),
|
||||
# old format, activity name with -
|
||||
ENTITY_NILE_TV: entity_registry.RegistryEntry(
|
||||
ENTITY_NILE_TV: er.RegistryEntry(
|
||||
entity_id=ENTITY_NILE_TV,
|
||||
unique_id="123443-Nile-TV",
|
||||
platform="harmony",
|
||||
config_entry_id=entry.entry_id,
|
||||
),
|
||||
# new format
|
||||
ENTITY_PLAY_MUSIC: entity_registry.RegistryEntry(
|
||||
ENTITY_PLAY_MUSIC: er.RegistryEntry(
|
||||
entity_id=ENTITY_PLAY_MUSIC,
|
||||
unique_id=f"activity_{PLAY_MUSIC_ACTIVITY_ID}",
|
||||
platform="harmony",
|
||||
config_entry_id=entry.entry_id,
|
||||
),
|
||||
# old entity which no longer has a matching activity on the hub. skipped.
|
||||
"switch.some_other_activity": entity_registry.RegistryEntry(
|
||||
"switch.some_other_activity": er.RegistryEntry(
|
||||
entity_id="switch.some_other_activity",
|
||||
unique_id="123443-Some Other Activity",
|
||||
platform="harmony",
|
||||
|
@ -60,7 +60,7 @@ async def test_unique_id_migration(mock_hc, hass, mock_write_config):
|
|||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
ent_reg = await entity_registry.async_get_registry(hass)
|
||||
ent_reg = er.async_get(hass)
|
||||
|
||||
switch_tv = ent_reg.async_get(ENTITY_WATCH_TV)
|
||||
assert switch_tv.unique_id == f"activity_{WATCH_TV_ACTIVITY_ID}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue