Update k-l* tests to use entity & device registry fixtures (#103929)

This commit is contained in:
Jan-Philipp Benecke 2023-11-13 20:02:33 +01:00 committed by GitHub
parent 1a3475ea60
commit 0eafc8f2cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 141 additions and 111 deletions

View file

@ -14,7 +14,6 @@ from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers.entity_registry import EntityRegistry
from homeassistant.setup import async_setup_component
from .common import CONFIG, VACUUM_ENTITY_ID, remove_device
@ -73,17 +72,19 @@ async def test_entry_not_setup(
async def test_device_remove_devices(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, mock_account: MagicMock
hass: HomeAssistant,
hass_ws_client: WebSocketGenerator,
device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry,
mock_account: MagicMock,
) -> None:
"""Test we can only remove a device that no longer exists."""
assert await async_setup_component(hass, "config", {})
config_entry = await setup_integration(hass, mock_account, VACUUM_DOMAIN)
registry: EntityRegistry = er.async_get(hass)
entity = registry.entities[VACUUM_ENTITY_ID]
entity = entity_registry.entities[VACUUM_ENTITY_ID]
assert entity.unique_id == "LR3C012345-litter_box"
device_registry = dr.async_get(hass)
device_entry = device_registry.async_get(entity.device_id)
assert (
await remove_device(