Skip to content

Commit

Permalink
Remove name from device info in devolo Home Network (home-assistant#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
Shutgun authored Oct 23, 2023
1 parent 9c0427a commit 04c0bca
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 9 deletions.
1 change: 0 additions & 1 deletion homeassistant/components/devolo_home_network/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def __init__(
identifiers={(DOMAIN, str(device.serial_number))},
manufacturer="devolo",
model=device.product,
name=entry.title,
serial_number=device.serial_number,
sw_version=device.firmware_version,
)
Expand Down
29 changes: 29 additions & 0 deletions tests/components/devolo_home_network/snapshots/test_init.ambr
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# serializer version: 1
# name: test_setup_entry
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': 'http://192.0.2.1',
'connections': set({
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'devolo_home_network',
'1234567890',
),
}),
'is_new': False,
'manufacturer': 'devolo',
'model': 'dLAN pro 1200+ WiFi ac',
'name': 'Mock Title',
'name_by_user': None,
'serial_number': '1234567890',
'suggested_area': None,
'sw_version': '5.6.1',
'via_device_id': None,
})
# ---
24 changes: 16 additions & 8 deletions tests/components/devolo_home_network/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from devolo_plc_api.exceptions.device import DeviceNotFound
import pytest
from syrupy.assertion import SnapshotAssertion

from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR
from homeassistant.components.button import DOMAIN as BUTTON
Expand All @@ -15,6 +16,7 @@
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import CONF_IP_ADDRESS, EVENT_HOMEASSISTANT_STOP
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.entity_platform import async_get_platforms

from . import configure_integration
Expand All @@ -24,16 +26,22 @@
from tests.common import MockConfigEntry


@pytest.mark.usefixtures("mock_device")
async def test_setup_entry(hass: HomeAssistant) -> None:
async def test_setup_entry(
hass: HomeAssistant,
mock_device: MockDevice,
device_registry: dr.DeviceRegistry,
snapshot: SnapshotAssertion,
) -> None:
"""Test setup entry."""
entry = configure_integration(hass)
with patch(
"homeassistant.config_entries.ConfigEntries.async_forward_entry_setup",
return_value=True,
), patch("homeassistant.core.EventBus.async_listen_once"):
assert await hass.config_entries.async_setup(entry.entry_id)
assert entry.state is ConfigEntryState.LOADED
assert await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
assert entry.state is ConfigEntryState.LOADED

device_info = device_registry.async_get_device(
{(DOMAIN, mock_device.serial_number)}
)
assert device_info == snapshot


@pytest.mark.usefixtures("mock_device")
Expand Down

0 comments on commit 04c0bca

Please sign in to comment.