Cleanup onewire tests (#92117)
This commit is contained in:
parent
58c5d98958
commit
7dfbfd45ae
3 changed files with 98 additions and 1013 deletions
|
@ -8,15 +8,13 @@ from homeassistant.components.onewire.const import (
|
|||
DOMAIN,
|
||||
INPUT_ENTRY_CLEAR_OPTIONS,
|
||||
INPUT_ENTRY_DEVICE_SELECTION,
|
||||
MANUFACTURER_MAXIM,
|
||||
)
|
||||
from homeassistant.config_entries import SOURCE_USER, ConfigEntry
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.config_validation import ensure_list
|
||||
|
||||
from .const import MOCK_OWPROXY_DEVICES
|
||||
|
||||
pytestmark = pytest.mark.usefixtures("mock_setup_entry")
|
||||
|
||||
|
@ -26,16 +24,14 @@ async def filled_device_registry(
|
|||
hass: HomeAssistant, config_entry: ConfigEntry, device_registry: dr.DeviceRegistry
|
||||
) -> dr.DeviceRegistry:
|
||||
"""Fill device registry with mock devices."""
|
||||
for device_details in MOCK_OWPROXY_DEVICES.values():
|
||||
if infos := device_details.get("device_info"):
|
||||
for info in ensure_list(infos):
|
||||
device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
identifiers=info["identifiers"],
|
||||
manufacturer=info["manufacturer"],
|
||||
model=info["model"],
|
||||
name=info["name"],
|
||||
)
|
||||
for key in ("28.111111111111", "28.222222222222", "28.222222222223"):
|
||||
device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
identifiers={(DOMAIN, key)},
|
||||
manufacturer=MANUFACTURER_MAXIM,
|
||||
model="DS18B20",
|
||||
name=key,
|
||||
)
|
||||
return device_registry
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue