From eb70d328caf98c04336e29756dc024169507d0a7 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 22 Nov 2021 11:51:47 +0100 Subject: [PATCH] Use DhcpServiceInfo in tplink (#60114) Co-authored-by: epenet --- tests/components/tplink/test_config_flow.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/components/tplink/test_config_flow.py b/tests/components/tplink/test_config_flow.py index 03757efa0ca7..d19b47ffd869 100644 --- a/tests/components/tplink/test_config_flow.py +++ b/tests/components/tplink/test_config_flow.py @@ -4,6 +4,7 @@ import pytest from homeassistant import config_entries, setup +from homeassistant.components import dhcp from homeassistant.components.tplink import DOMAIN from homeassistant.const import CONF_DEVICE, CONF_HOST, CONF_MAC, CONF_NAME from homeassistant.core import HomeAssistant @@ -308,7 +309,9 @@ async def test_discovered_by_discovery_and_dhcp(hass): result2 = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_DHCP}, - data={"ip": IP_ADDRESS, "macaddress": MAC_ADDRESS, "hostname": ALIAS}, + data=dhcp.DhcpServiceInfo( + ip=IP_ADDRESS, macaddress=MAC_ADDRESS, hostname=ALIAS + ), ) await hass.async_block_till_done() assert result2["type"] == RESULT_TYPE_ABORT @@ -318,7 +321,7 @@ async def test_discovered_by_discovery_and_dhcp(hass): result3 = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_DHCP}, - data={"ip": IP_ADDRESS, "macaddress": "00:00:00:00:00:00"}, + data=dhcp.DhcpServiceInfo(ip=IP_ADDRESS, macaddress="00:00:00:00:00:00"), ) await hass.async_block_till_done() assert result3["type"] == RESULT_TYPE_ABORT @@ -328,7 +331,7 @@ async def test_discovered_by_discovery_and_dhcp(hass): result3 = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_DHCP}, - data={"ip": "1.2.3.5", "macaddress": "00:00:00:00:00:01"}, + data=dhcp.DhcpServiceInfo(ip="1.2.3.5", macaddress="00:00:00:00:00:01"), ) await hass.async_block_till_done() assert result3["type"] == RESULT_TYPE_ABORT @@ -340,7 +343,7 @@ async def test_discovered_by_discovery_and_dhcp(hass): [ ( config_entries.SOURCE_DHCP, - {"ip": IP_ADDRESS, "macaddress": MAC_ADDRESS, "hostname": ALIAS}, + dhcp.DhcpServiceInfo(ip=IP_ADDRESS, macaddress=MAC_ADDRESS, hostname=ALIAS), ), ( config_entries.SOURCE_DISCOVERY, @@ -381,7 +384,7 @@ async def test_discovered_by_dhcp_or_discovery(hass, source, data): [ ( config_entries.SOURCE_DHCP, - {"ip": IP_ADDRESS, "macaddress": MAC_ADDRESS, "hostname": ALIAS}, + dhcp.DhcpServiceInfo(ip=IP_ADDRESS, macaddress=MAC_ADDRESS, hostname=ALIAS), ), ( config_entries.SOURCE_DISCOVERY,