Use ATTR_VIA_DEVICE constant in onewire tests (#58405)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-10-25 15:42:40 +02:00 committed by GitHub
parent 29c95a0b34
commit 42793927f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -15,6 +15,7 @@ from homeassistant.const import (
ATTR_MODEL,
ATTR_NAME,
ATTR_STATE,
ATTR_VIA_DEVICE,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import DeviceRegistry
@ -57,7 +58,7 @@ def check_device_registry(
assert registry_entry.manufacturer == expected_device[ATTR_MANUFACTURER]
assert registry_entry.name == expected_device[ATTR_NAME]
assert registry_entry.model == expected_device[ATTR_MODEL]
if expected_via_device := expected_device.get("via_device"):
if expected_via_device := expected_device.get(ATTR_VIA_DEVICE):
assert registry_entry.via_device_id is not None
parent_entry = device_registry.async_get_device({expected_via_device})
assert parent_entry is not None

View File

@ -20,6 +20,7 @@ from homeassistant.const import (
ATTR_NAME,
ATTR_STATE,
ATTR_UNIT_OF_MEASUREMENT,
ATTR_VIA_DEVICE,
DEVICE_CLASS_CURRENT,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_ILLUMINANCE,
@ -224,7 +225,7 @@ MOCK_OWPROXY_DEVICES = {
ATTR_MANUFACTURER: MANUFACTURER,
ATTR_MODEL: "DS2423",
ATTR_NAME: "1D.111111111111",
"via_device": (DOMAIN, "1F.111111111111"),
ATTR_VIA_DEVICE: (DOMAIN, "1F.111111111111"),
},
],
"branches": {