mirror of
https://github.com/home-assistant/core.git
synced 2025-11-12 12:30:31 +00:00
Add websocket list APIs for the registries (#16597)
* Add websocket list APIs for the registries * Remove identifiers * Fix tests * Use ordered dict
This commit is contained in:
@@ -19,7 +19,7 @@ from homeassistant.setup import setup_component, async_setup_component
|
||||
from homeassistant.config import async_process_component_config
|
||||
from homeassistant.helpers import (
|
||||
intent, entity, restore_state, entity_registry,
|
||||
entity_platform, storage)
|
||||
entity_platform, storage, device_registry)
|
||||
from homeassistant.util.unit_system import METRIC_SYSTEM
|
||||
import homeassistant.util.dt as date_util
|
||||
import homeassistant.util.yaml as yaml
|
||||
@@ -332,6 +332,19 @@ def mock_registry(hass, mock_entries=None):
|
||||
return registry
|
||||
|
||||
|
||||
def mock_device_registry(hass, mock_entries=None):
|
||||
"""Mock the Device Registry."""
|
||||
registry = device_registry.DeviceRegistry(hass)
|
||||
registry.devices = mock_entries or OrderedDict()
|
||||
|
||||
async def _get_reg():
|
||||
return registry
|
||||
|
||||
hass.data[device_registry.DATA_REGISTRY] = \
|
||||
hass.loop.create_task(_get_reg())
|
||||
return registry
|
||||
|
||||
|
||||
class MockUser(auth_models.User):
|
||||
"""Mock a user in Home Assistant."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user