Add device test for Peblar Rocksolid EV Chargers (#133713)

This commit is contained in:
Franck Nijhof 2024-12-21 13:03:44 +01:00 committed by GitHub
parent 11efec49db
commit a3fab094c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,41 @@
# serializer version: 1
# name: test_peblar_device_entry
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': 'http://127.0.0.127',
'connections': set({
tuple(
'mac',
'00:0f:11:58:86:97',
),
tuple(
'mac',
'00:0f:11:58:86:99',
),
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'peblar',
'23-45-A4O-MOF',
),
}),
'is_new': False,
'labels': set({
}),
'manufacturer': 'Peblar',
'model': 'WLAC1-H11R0WE0ICR00',
'model_id': '6004-2300-8002',
'name': 'Peblar EV Charger',
'name_by_user': None,
'primary_config_entry': <ANY>,
'serial_number': '23-45-A4O-MOF',
'suggested_area': None,
'sw_version': '1.6.1+1+WL-1',
'via_device_id': None,
})
# ---

View File

@ -4,10 +4,12 @@ from unittest.mock import MagicMock
from peblar import PeblarAuthenticationError, PeblarConnectionError, PeblarError from peblar import PeblarAuthenticationError, PeblarConnectionError, PeblarError
import pytest import pytest
from syrupy.assertion import SnapshotAssertion
from homeassistant.components.peblar.const import DOMAIN from homeassistant.components.peblar.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr
from tests.common import MockConfigEntry from tests.common import MockConfigEntry
@ -67,3 +69,17 @@ async def test_config_entry_authentication_failed(
await hass.async_block_till_done() await hass.async_block_till_done()
assert mock_config_entry.state is ConfigEntryState.SETUP_ERROR assert mock_config_entry.state is ConfigEntryState.SETUP_ERROR
@pytest.mark.usefixtures("init_integration")
async def test_peblar_device_entry(
device_registry: dr.DeviceRegistry,
snapshot: SnapshotAssertion,
) -> None:
"""Test authentication error, aborts setup."""
assert (
device_entry := device_registry.async_get_device(
identifiers={(DOMAIN, "23-45-A4O-MOF")}
)
)
assert device_entry == snapshot