Skip to content

Commit

Permalink
Use DhcpServiceInfo in tplink (#60114)
Browse files Browse the repository at this point in the history
Co-authored-by: epenet <epenet@users.noreply.github.com>
  • Loading branch information
epenet and epenet committed Nov 22, 2021
1 parent 70f43a1 commit eb70d32
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/components/tplink/test_config_flow.py
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit eb70d32

Please sign in to comment.