Use dataclass properties in devolo_home_network tests (#60889)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-03 08:51:42 +01:00 committed by GitHub
parent b70d24394e
commit c04bfcc7f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,6 @@
"""Tests for the devolo Home Network integration."""
import dataclasses
from typing import Any
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):
"""Give a mocked device the needed properties."""
self.plcnet = PlcNetApi(IP, None, DISCOVERY_INFO)
self.device = DeviceApi(IP, None, DISCOVERY_INFO)
self.plcnet = PlcNetApi(IP, None, dataclasses.asdict(DISCOVERY_INFO))
self.device = DeviceApi(IP, None, dataclasses.asdict(DISCOVERY_INFO))

View File

@ -30,8 +30,8 @@ def mock_device():
def mock_validate_input():
"""Mock setup entry and user input."""
info = {
"serial_number": DISCOVERY_INFO["properties"]["SN"],
"title": DISCOVERY_INFO["properties"]["Product"],
"serial_number": DISCOVERY_INFO.properties["SN"],
"title": DISCOVERY_INFO.properties["Product"],
}
with patch(

View File

@ -99,7 +99,7 @@ async def test_zeroconf(hass: HomeAssistant):
assert (
context["title_placeholders"][CONF_NAME]
== DISCOVERY_INFO["hostname"].split(".", maxsplit=1)[0]
== DISCOVERY_INFO.hostname.split(".", maxsplit=1)[0]
)
with patch(