Snapshot Ondilo Ico devices (#116932)

Co-authored-by: JeromeHXP <dartdoka@mainguet.fr>
This commit is contained in:
Joost Lekkerkerker 2024-05-06 20:34:29 +02:00 committed by GitHub
parent b456d97e65
commit ffa8265365
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,61 @@
# serializer version: 1
# name: test_devices[ondilo_ico-W1122333044455]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': None,
'connections': set({
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'ondilo_ico',
'W1122333044455',
),
}),
'is_new': False,
'labels': set({
}),
'manufacturer': 'Ondilo',
'model': 'ICO',
'name': 'Pool 1',
'name_by_user': None,
'serial_number': None,
'suggested_area': None,
'sw_version': '1.7.1-stable',
'via_device_id': None,
})
# ---
# name: test_devices[ondilo_ico-W2233304445566]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': None,
'connections': set({
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'ondilo_ico',
'W2233304445566',
),
}),
'is_new': False,
'labels': set({
}),
'manufacturer': 'Ondilo',
'model': 'ICO',
'name': 'Pool 2',
'name_by_user': None,
'serial_number': None,
'suggested_area': None,
'sw_version': '1.7.1-stable',
'via_device_id': None,
})
# ---

View File

@ -3,14 +3,38 @@
from typing import Any
from unittest.mock import MagicMock
from syrupy import SnapshotAssertion
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr
from . import setup_integration
from tests.common import MockConfigEntry
async def test_devices(
hass: HomeAssistant,
mock_ondilo_client: MagicMock,
device_registry: dr.DeviceRegistry,
config_entry: MockConfigEntry,
snapshot: SnapshotAssertion,
) -> None:
"""Test devices are registered."""
await setup_integration(hass, config_entry, mock_ondilo_client)
device_entries = dr.async_entries_for_config_entry(
device_registry, config_entry.entry_id
)
assert len(device_entries) == 2
for device_entry in device_entries:
identifier = list(device_entry.identifiers)[0]
assert device_entry == snapshot(name=f"{identifier[0]}-{identifier[1]}")
async def test_init_with_no_ico_attached(
hass: HomeAssistant,
mock_ondilo_client: MagicMock,