mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 18:39:30 +00:00
Improve performance of extracting entities by label (#114720)
This commit is contained in:
@@ -5,7 +5,7 @@ import json
|
||||
import logging
|
||||
import os
|
||||
from types import ModuleType
|
||||
from unittest.mock import Mock, call, patch
|
||||
from unittest.mock import call, patch
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -25,6 +25,7 @@ from homeassistant.const import (
|
||||
from homeassistant.core import HomeAssistant, State, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import discovery
|
||||
from homeassistant.helpers.entity_registry import RegistryEntry
|
||||
from homeassistant.helpers.json import JSONEncoder
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
@@ -396,10 +397,16 @@ async def test_see_service_guard_config_entry(
|
||||
mock_device_tracker_conf: list[legacy.Device],
|
||||
) -> None:
|
||||
"""Test the guard if the device is registered in the entity registry."""
|
||||
mock_entry = Mock()
|
||||
dev_id = "test"
|
||||
entity_id = f"{const.DOMAIN}.{dev_id}"
|
||||
mock_registry(hass, {entity_id: mock_entry})
|
||||
mock_registry(
|
||||
hass,
|
||||
{
|
||||
entity_id: RegistryEntry(
|
||||
entity_id=entity_id, unique_id=1, platform=const.DOMAIN
|
||||
)
|
||||
},
|
||||
)
|
||||
devices = mock_device_tracker_conf
|
||||
assert await async_setup_component(hass, device_tracker.DOMAIN, TEST_PLATFORM)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
Reference in New Issue
Block a user