diff --git a/tests/components/ondilo_ico/snapshots/test_init.ambr b/tests/components/ondilo_ico/snapshots/test_init.ambr new file mode 100644 index 00000000000..c488b1e3c15 --- /dev/null +++ b/tests/components/ondilo_ico/snapshots/test_init.ambr @@ -0,0 +1,61 @@ +# serializer version: 1 +# name: test_devices[ondilo_ico-W1122333044455] + DeviceRegistryEntrySnapshot({ + 'area_id': None, + 'config_entries': , + 'configuration_url': None, + 'connections': set({ + }), + 'disabled_by': None, + 'entry_type': None, + 'hw_version': None, + 'id': , + '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': , + 'configuration_url': None, + 'connections': set({ + }), + 'disabled_by': None, + 'entry_type': None, + 'hw_version': None, + 'id': , + '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, + }) +# --- diff --git a/tests/components/ondilo_ico/test_init.py b/tests/components/ondilo_ico/test_init.py index 28897f97fa1..707022e9145 100644 --- a/tests/components/ondilo_ico/test_init.py +++ b/tests/components/ondilo_ico/test_init.py @@ -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,