mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Use dataclass properties in devolo_home_network tests (#60889)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
b70d24394e
commit
c04bfcc7f4
@ -1,5 +1,6 @@
|
|||||||
"""Tests for the devolo Home Network integration."""
|
"""Tests for the devolo Home Network integration."""
|
||||||
|
|
||||||
|
import dataclasses
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from devolo_plc_api.device_api.deviceapi import DeviceApi
|
from devolo_plc_api.device_api.deviceapi import DeviceApi
|
||||||
@ -27,5 +28,5 @@ def configure_integration(hass: HomeAssistant) -> MockConfigEntry:
|
|||||||
|
|
||||||
async def async_connect(self, session_instance: Any = None):
|
async def async_connect(self, session_instance: Any = None):
|
||||||
"""Give a mocked device the needed properties."""
|
"""Give a mocked device the needed properties."""
|
||||||
self.plcnet = PlcNetApi(IP, None, DISCOVERY_INFO)
|
self.plcnet = PlcNetApi(IP, None, dataclasses.asdict(DISCOVERY_INFO))
|
||||||
self.device = DeviceApi(IP, None, DISCOVERY_INFO)
|
self.device = DeviceApi(IP, None, dataclasses.asdict(DISCOVERY_INFO))
|
||||||
|
@ -30,8 +30,8 @@ def mock_device():
|
|||||||
def mock_validate_input():
|
def mock_validate_input():
|
||||||
"""Mock setup entry and user input."""
|
"""Mock setup entry and user input."""
|
||||||
info = {
|
info = {
|
||||||
"serial_number": DISCOVERY_INFO["properties"]["SN"],
|
"serial_number": DISCOVERY_INFO.properties["SN"],
|
||||||
"title": DISCOVERY_INFO["properties"]["Product"],
|
"title": DISCOVERY_INFO.properties["Product"],
|
||||||
}
|
}
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
|
@ -99,7 +99,7 @@ async def test_zeroconf(hass: HomeAssistant):
|
|||||||
|
|
||||||
assert (
|
assert (
|
||||||
context["title_placeholders"][CONF_NAME]
|
context["title_placeholders"][CONF_NAME]
|
||||||
== DISCOVERY_INFO["hostname"].split(".", maxsplit=1)[0]
|
== DISCOVERY_INFO.hostname.split(".", maxsplit=1)[0]
|
||||||
)
|
)
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user