mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Snapshot Ondilo Ico devices (#116932)
Co-authored-by: JeromeHXP <dartdoka@mainguet.fr>
This commit is contained in:
parent
b456d97e65
commit
ffa8265365
61
tests/components/ondilo_ico/snapshots/test_init.ambr
Normal file
61
tests/components/ondilo_ico/snapshots/test_init.ambr
Normal 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,
|
||||
})
|
||||
# ---
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user