mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Adjust entity registry access in tests (1) (#88950)
This commit is contained in:
@@ -18,7 +18,7 @@ from homeassistant.const import (
|
||||
SERVICE_STOP_COVER,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.common import async_fire_time_changed, get_fixture_path
|
||||
@@ -171,7 +171,9 @@ async def test_move_cover_failure(
|
||||
assert "return code 1" in caplog.text
|
||||
|
||||
|
||||
async def test_unique_id(hass: HomeAssistant) -> None:
|
||||
async def test_unique_id(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
) -> None:
|
||||
"""Test unique_id option and if it only creates one cover per id."""
|
||||
await setup_test_entity(
|
||||
hass,
|
||||
@@ -199,11 +201,8 @@ async def test_unique_id(hass: HomeAssistant) -> None:
|
||||
|
||||
assert len(hass.states.async_all()) == 2
|
||||
|
||||
ent_reg = entity_registry.async_get(hass)
|
||||
|
||||
assert len(ent_reg.entities) == 2
|
||||
assert ent_reg.async_get_entity_id("cover", "command_line", "unique") is not None
|
||||
assert (
|
||||
ent_reg.async_get_entity_id("cover", "command_line", "not-so-unique-anymore")
|
||||
is not None
|
||||
assert len(entity_registry.entities) == 2
|
||||
assert entity_registry.async_get_entity_id("cover", "command_line", "unique")
|
||||
assert entity_registry.async_get_entity_id(
|
||||
"cover", "command_line", "not-so-unique-anymore"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user