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

Adjust helpers tests which create devices (#98214)

This commit is contained in:
Erik Montnemery
2023-08-10 19:28:16 +02:00
committed by GitHub
parent f1d4a4bd26
commit c7b4d4f361
5 changed files with 39 additions and 9 deletions

View File

@@ -18,6 +18,8 @@ from homeassistant.helpers import (
)
from homeassistant.setup import async_setup_component
from tests.common import MockConfigEntry
class MockIntentHandler(intent.IntentHandler):
"""Provide a mock intent handler."""
@@ -116,11 +118,15 @@ async def test_match_device_area(
entity_registry: er.EntityRegistry,
) -> None:
"""Test async_match_state with a device in an area."""
config_entry = MockConfigEntry()
config_entry.add_to_hass(hass)
area_kitchen = area_registry.async_get_or_create("kitchen")
area_bedroom = area_registry.async_get_or_create("bedroom")
kitchen_device = device_registry.async_get_or_create(
config_entry_id="1234", connections=set(), identifiers={("demo", "id-1234")}
config_entry_id=config_entry.entry_id,
connections=set(),
identifiers={("demo", "id-1234")},
)
device_registry.async_update_device(kitchen_device.id, area_id=area_kitchen.id)