1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +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:
Paulus Schoutsen
2018-09-14 11:57:18 +02:00
committed by GitHub
parent 67b5b5bc85
commit 05c0717167
7 changed files with 210 additions and 19 deletions

View File

@@ -1,28 +1,14 @@
"""Tests for the Device Registry."""
import pytest
from collections import OrderedDict
from homeassistant.helpers import device_registry
def mock_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
from tests.common import mock_device_registry
@pytest.fixture
def registry(hass):
"""Return an empty, loaded, registry."""
return mock_registry(hass)
return mock_device_registry(hass)
async def test_get_or_create_returns_same_entry(registry):