Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions tests/components/gogogate2/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ async def test_form_homekit_unique_id_already_setup(hass):
DOMAIN,
context={"source": config_entries.SOURCE_HOMEKIT},
data=zeroconf.ZeroconfServiceInfo(
host="1.2.3.4", properties={zeroconf.ATTR_PROPERTIES_ID: MOCK_MAC_ADDR}
host="1.2.3.4",
hostname="mock_hostname",
name="mock_name",
port=None,
properties={zeroconf.ATTR_PROPERTIES_ID: MOCK_MAC_ADDR},
type="mock_type",
),
)
assert result["type"] == RESULT_TYPE_FORM
Expand All @@ -130,7 +135,12 @@ async def test_form_homekit_unique_id_already_setup(hass):
DOMAIN,
context={"source": config_entries.SOURCE_HOMEKIT},
data=zeroconf.ZeroconfServiceInfo(
host="1.2.3.4", properties={zeroconf.ATTR_PROPERTIES_ID: MOCK_MAC_ADDR}
host="1.2.3.4",
hostname="mock_hostname",
name="mock_name",
port=None,
properties={zeroconf.ATTR_PROPERTIES_ID: MOCK_MAC_ADDR},
type="mock_type",
),
)
assert result["type"] == RESULT_TYPE_ABORT
Expand All @@ -149,7 +159,12 @@ async def test_form_homekit_ip_address_already_setup(hass):
DOMAIN,
context={"source": config_entries.SOURCE_HOMEKIT},
data=zeroconf.ZeroconfServiceInfo(
host="1.2.3.4", properties={zeroconf.ATTR_PROPERTIES_ID: MOCK_MAC_ADDR}
host="1.2.3.4",
hostname="mock_hostname",
name="mock_name",
port=None,
properties={zeroconf.ATTR_PROPERTIES_ID: MOCK_MAC_ADDR},
type="mock_type",
),
)
assert result["type"] == RESULT_TYPE_ABORT
Expand All @@ -162,7 +177,12 @@ async def test_form_homekit_ip_address(hass):
DOMAIN,
context={"source": config_entries.SOURCE_HOMEKIT},
data=zeroconf.ZeroconfServiceInfo(
host="1.2.3.4", properties={zeroconf.ATTR_PROPERTIES_ID: MOCK_MAC_ADDR}
host="1.2.3.4",
hostname="mock_hostname",
name="mock_name",
port=None,
properties={zeroconf.ATTR_PROPERTIES_ID: MOCK_MAC_ADDR},
type="mock_type",
),
)
assert result["type"] == RESULT_TYPE_FORM
Expand Down Expand Up @@ -237,7 +257,12 @@ async def test_discovered_by_homekit_and_dhcp(hass):
DOMAIN,
context={"source": config_entries.SOURCE_HOMEKIT},
data=zeroconf.ZeroconfServiceInfo(
host="1.2.3.4", properties={zeroconf.ATTR_PROPERTIES_ID: MOCK_MAC_ADDR}
host="1.2.3.4",
hostname="mock_hostname",
name="mock_name",
port=None,
properties={zeroconf.ATTR_PROPERTIES_ID: MOCK_MAC_ADDR},
type="mock_type",
),
)
assert result["type"] == RESULT_TYPE_FORM
Expand Down
4 changes: 2 additions & 2 deletions tests/components/homekit_controller/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,9 @@ def get_device_discovery_info(
record = device.info
result = zeroconf.ZeroconfServiceInfo(
host=record["address"],
port=record["port"],
hostname=record["name"],
type="_hap._tcp.local.",
name=record["name"],
port=record["port"],
properties={
"md": record["md"],
"pv": record["pv"],
Expand All @@ -156,6 +155,7 @@ def get_device_discovery_info(
"sf": 0x01, # record["sf"],
"sh": "",
},
type="_hap._tcp.local.",
)

if missing_csharp:
Expand Down
8 changes: 8 additions & 0 deletions tests/components/hue/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,11 @@ async def test_bridge_homekit(hass, aioclient_mock):
context={"source": config_entries.SOURCE_HOMEKIT},
data=zeroconf.ZeroconfServiceInfo(
host="0.0.0.0",
hostname="mock_hostname",
name="mock_name",
port=None,
properties={zeroconf.ATTR_PROPERTIES_ID: "aa:bb:cc:dd:ee:ff"},
type="mock_type",
),
)

Expand Down Expand Up @@ -560,7 +564,11 @@ async def test_bridge_homekit_already_configured(hass, aioclient_mock):
context={"source": config_entries.SOURCE_HOMEKIT},
data=zeroconf.ZeroconfServiceInfo(
host="0.0.0.0",
hostname="mock_hostname",
name="mock_name",
port=None,
properties={zeroconf.ATTR_PROPERTIES_ID: "aa:bb:cc:dd:ee:ff"},
type="mock_type",
),
)

Expand Down
13 changes: 10 additions & 3 deletions tests/components/hunterdouglas_powerview/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@
from tests.common import MockConfigEntry, load_fixture

HOMEKIT_DISCOVERY_INFO = zeroconf.ZeroconfServiceInfo(
name="Hunter Douglas Powerview Hub._hap._tcp.local.",
host="1.2.3.4",
properties={"id": "AA::BB::CC::DD::EE::FF"},
hostname="mock_hostname",
name="Hunter Douglas Powerview Hub._hap._tcp.local.",
port=None,
properties={zeroconf.ATTR_PROPERTIES_ID: "AA::BB::CC::DD::EE::FF"},
type="mock_type",
)

ZEROCONF_DISCOVERY_INFO = zeroconf.ZeroconfServiceInfo(
name="Hunter Douglas Powerview Hub._powerview._tcp.local.",
host="1.2.3.4",
hostname="mock_hostname",
name="Hunter Douglas Powerview Hub._powerview._tcp.local.",
port=None,
properties={},
type="mock_type",
)

DHCP_DISCOVERY_INFO = dhcp.DhcpServiceInfo(
Expand Down
16 changes: 16 additions & 0 deletions tests/components/lutron_caseta/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,10 @@ async def test_zeroconf_host_already_configured(hass, tmpdir):
data=zeroconf.ZeroconfServiceInfo(
host="1.1.1.1",
hostname="lutron-abc.local.",
name="mock_name",
port=None,
properties={},
type="mock_type",
),
)
await hass.async_block_till_done()
Expand All @@ -451,6 +455,10 @@ async def test_zeroconf_lutron_id_already_configured(hass):
data=zeroconf.ZeroconfServiceInfo(
host="1.1.1.1",
hostname="lutron-abc.local.",
name="mock_name",
port=None,
properties={},
type="mock_type",
),
)
await hass.async_block_till_done()
Expand All @@ -469,6 +477,10 @@ async def test_zeroconf_not_lutron_device(hass):
data=zeroconf.ZeroconfServiceInfo(
host="1.1.1.1",
hostname="notlutron-abc.local.",
name="mock_name",
port=None,
properties={},
type="mock_type",
),
)
await hass.async_block_till_done()
Expand All @@ -493,6 +505,10 @@ async def test_zeroconf(hass, source, tmpdir):
data=zeroconf.ZeroconfServiceInfo(
host="1.1.1.1",
hostname="lutron-abc.local.",
name="mock_name",
port=None,
properties={},
type="mock_type",
),
)
await hass.async_block_till_done()
Expand Down
24 changes: 21 additions & 3 deletions tests/components/modern_forms/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ async def test_full_zeroconf_flow_implementation(
DOMAIN,
context={"source": SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
host="192.168.1.123", hostname="example.local.", properties={}
host="192.168.1.123",
hostname="example.local.",
name="mock_name",
port=None,
properties={},
type="mock_type",
),
)

Expand Down Expand Up @@ -134,7 +139,12 @@ async def test_zeroconf_connection_error(
DOMAIN,
context={"source": SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
host="192.168.1.123", hostname="example.local.", properties={}
host="192.168.1.123",
hostname="example.local.",
name="mock_name",
port=None,
properties={},
type="mock_type",
),
)

Expand All @@ -160,7 +170,12 @@ async def test_zeroconf_confirm_connection_error(
CONF_NAME: "test",
},
data=zeroconf.ZeroconfServiceInfo(
host="192.168.1.123", hostname="example.com.", properties={}
host="192.168.1.123",
hostname="example.com.",
name="mock_name",
port=None,
properties={},
type="mock_type",
),
)

Expand Down Expand Up @@ -226,7 +241,10 @@ async def test_zeroconf_with_mac_device_exists_abort(
data=zeroconf.ZeroconfServiceInfo(
host="192.168.1.123",
hostname="example.local.",
name="mock_name",
port=None,
properties={CONF_MAC: "AA:BB:CC:DD:EE:FF"},
type="mock_type",
),
)

Expand Down