Clean up accessing device_registry helpers via hass (#72031)
This commit is contained in:
parent
69e622b327
commit
c3d19f3827
28 changed files with 105 additions and 87 deletions
|
@ -17,8 +17,7 @@ from homeassistant.const import (
|
|||
STATE_UNAVAILABLE,
|
||||
STATE_UNKNOWN,
|
||||
)
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers.device_registry import DeviceEntryType
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.util import dt
|
||||
|
||||
from tests.common import (
|
||||
|
@ -497,13 +496,13 @@ class TestPicnicSensor(unittest.IsolatedAsyncioTestCase):
|
|||
# Setup platform and default mock responses
|
||||
await self._setup_platform(use_default_responses=True)
|
||||
|
||||
device_registry = await self.hass.helpers.device_registry.async_get_registry()
|
||||
device_registry = dr.async_get(self.hass)
|
||||
picnic_service = device_registry.async_get_device(
|
||||
identifiers={(const.DOMAIN, DEFAULT_USER_RESPONSE["user_id"])}
|
||||
)
|
||||
assert picnic_service.model == DEFAULT_USER_RESPONSE["user_id"]
|
||||
assert picnic_service.name == "Picnic: Commonstreet 123a"
|
||||
assert picnic_service.entry_type is DeviceEntryType.SERVICE
|
||||
assert picnic_service.entry_type is dr.DeviceEntryType.SERVICE
|
||||
|
||||
async def test_auth_token_is_saved_on_update(self):
|
||||
"""Test that auth-token changes in the session object are reflected by the config entry."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue