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
17 changes: 14 additions & 3 deletions tests/components/apple_tv/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
from tests.common import MockConfigEntry

DMAP_SERVICE = zeroconf.ZeroconfServiceInfo(
type="_touch-able._tcp.local.",
host="mock_host",
hostname="mock_hostname",
name="dmapid.something",
port=None,
properties={"CtlN": "Apple TV"},
type="_touch-able._tcp.local.",
)


Expand Down Expand Up @@ -401,8 +404,12 @@ async def test_zeroconf_unsupported_service_aborts(hass):
DOMAIN,
context={"source": config_entries.SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
type="_dummy._tcp.local.",
host="mock_host",
hostname="mock_hostname",
name="mock_name",
port=None,
properties={},
type="_dummy._tcp.local.",
),
)
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
Expand All @@ -415,8 +422,12 @@ async def test_zeroconf_add_mrp_device(hass, mrp_device, pairing):
DOMAIN,
context={"source": config_entries.SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
type="_mediaremotetv._tcp.local.",
host="mock_host",
hostname="mock_hostname",
name="mock_name",
port=None,
properties={"UniqueIdentifier": "mrpid", "Name": "Kitchen"},
type="_mediaremotetv._tcp.local.",
),
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
Expand Down
16 changes: 12 additions & 4 deletions tests/components/axis/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,11 @@ async def test_discovery_flow(hass, source: str, discovery_info: dict):
SOURCE_ZEROCONF,
zeroconf.ZeroconfServiceInfo(
host=DEFAULT_HOST,
port=80,
hostname="mock_hostname",
name=f"AXIS M1065-LW - {MAC}._axis-video._tcp.local.",
port=80,
properties={"macaddress": MAC},
type="mock_type",
),
),
],
Expand Down Expand Up @@ -412,9 +414,11 @@ async def test_discovered_device_already_configured(
SOURCE_ZEROCONF,
zeroconf.ZeroconfServiceInfo(
host="2.3.4.5",
port=8080,
hostname="mock_hostname",
name=f"AXIS M1065-LW - {MAC}._axis-video._tcp.local.",
port=8080,
properties={"macaddress": MAC},
type="mock_type",
),
8080,
),
Expand Down Expand Up @@ -480,9 +484,11 @@ async def test_discovery_flow_updated_configuration(
SOURCE_ZEROCONF,
zeroconf.ZeroconfServiceInfo(
host="",
port=0,
hostname="mock_hostname",
name="",
port=0,
properties={"macaddress": "01234567890"},
type="mock_type",
),
),
],
Expand Down Expand Up @@ -522,9 +528,11 @@ async def test_discovery_flow_ignore_non_axis_device(
SOURCE_ZEROCONF,
zeroconf.ZeroconfServiceInfo(
host="169.254.3.4",
port=80,
hostname="mock_hostname",
name=f"AXIS M1065-LW - {MAC}._axis-video._tcp.local.",
port=80,
properties={"macaddress": MAC},
type="mock_type",
),
),
],
Expand Down
45 changes: 38 additions & 7 deletions tests/components/bond/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,12 @@ async def test_zeroconf_form(hass: core.HomeAssistant):
DOMAIN,
context={"source": config_entries.SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
name="test-bond-id.some-other-tail-info", host="test-host"
host="test-host",
hostname="mock_hostname",
name="test-bond-id.some-other-tail-info",
port=None,
properties={},
type="mock_type",
),
)
assert result["type"] == "form"
Expand Down Expand Up @@ -230,7 +235,12 @@ async def test_zeroconf_form_token_unavailable(hass: core.HomeAssistant):
DOMAIN,
context={"source": config_entries.SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
name="test-bond-id.some-other-tail-info", host="test-host"
host="test-host",
hostname="mock_hostname",
name="test-bond-id.some-other-tail-info",
port=None,
properties={},
type="mock_type",
),
)
await hass.async_block_till_done()
Expand Down Expand Up @@ -265,7 +275,12 @@ async def test_zeroconf_form_with_token_available(hass: core.HomeAssistant):
DOMAIN,
context={"source": config_entries.SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
name="test-bond-id.some-other-tail-info", host="test-host"
host="test-host",
hostname="mock_hostname",
name="test-bond-id.some-other-tail-info",
port=None,
properties={},
type="mock_type",
),
)
await hass.async_block_till_done()
Expand Down Expand Up @@ -303,8 +318,12 @@ async def test_zeroconf_already_configured(hass: core.HomeAssistant):
DOMAIN,
context={"source": config_entries.SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
name="already-registered-bond-id.some-other-tail-info",
host="updated-host",
hostname="mock_hostname",
name="already-registered-bond-id.some-other-tail-info",
port=None,
properties={},
type="mock_type",
),
)

Expand Down Expand Up @@ -344,8 +363,12 @@ async def test_zeroconf_already_configured_refresh_token(hass: core.HomeAssistan
DOMAIN,
context={"source": config_entries.SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
name="already-registered-bond-id.some-other-tail-info",
host="updated-host",
hostname="mock_hostname",
name="already-registered-bond-id.some-other-tail-info",
port=None,
properties={},
type="mock_type",
),
)
await hass.async_block_till_done()
Expand Down Expand Up @@ -377,8 +400,12 @@ async def test_zeroconf_already_configured_no_reload_same_host(
DOMAIN,
context={"source": config_entries.SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
name="already-registered-bond-id.some-other-tail-info",
host="stored-host",
hostname="mock_hostname",
name="already-registered-bond-id.some-other-tail-info",
port=None,
properties={},
type="mock_type",
),
)
await hass.async_block_till_done()
Expand All @@ -394,8 +421,12 @@ async def test_zeroconf_form_unexpected_error(hass: core.HomeAssistant):
hass,
source=config_entries.SOURCE_ZEROCONF,
initial_input=zeroconf.ZeroconfServiceInfo(
name="test-bond-id.some-other-tail-info",
host="test-host",
hostname="mock_hostname",
name="test-bond-id.some-other-tail-info",
port=None,
properties={},
type="mock_type",
),
user_input={CONF_ACCESS_TOKEN: "test-token"},
error=Exception(),
Expand Down
19 changes: 14 additions & 5 deletions tests/components/bosch_shc/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
}
DISCOVERY_INFO = zeroconf.ZeroconfServiceInfo(
host=["169.1.1.1", "1.1.1.1"],
port=0,
hostname="shc012345.local.",
type="_http._tcp.local.",
name="Bosch SHC [test-mac]._http._tcp.local.",
port=0,
properties={},
type="_http._tcp.local.",
)


Expand Down Expand Up @@ -530,10 +531,11 @@ async def test_zeroconf_link_local(hass, mock_zeroconf):
"""Test we get the form."""
DISCOVERY_INFO_LINK_LOCAL = zeroconf.ZeroconfServiceInfo(
host=["169.1.1.1"],
port=0,
hostname="shc012345.local.",
type="_http._tcp.local.",
name="Bosch SHC [test-mac]._http._tcp.local.",
port=0,
properties={},
type="_http._tcp.local.",
)

with patch(
Expand All @@ -552,7 +554,14 @@ async def test_zeroconf_not_bosch_shc(hass, mock_zeroconf):
"""Test we filter out non-bosch_shc devices."""
result = await hass.config_entries.flow.async_init(
DOMAIN,
data=zeroconf.ZeroconfServiceInfo(host="1.1.1.1", name="notboschshc"),
data=zeroconf.ZeroconfServiceInfo(
host="1.1.1.1",
hostname="mock_hostname",
name="notboschshc",
port=None,
properties={},
type="mock_type",
),
context={"source": config_entries.SOURCE_ZEROCONF},
)
assert result["type"] == "abort"
Expand Down
31 changes: 27 additions & 4 deletions tests/components/brother/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@ async def test_zeroconf_snmp_error(hass):
DOMAIN,
context={"source": SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
hostname="example.local.", name="Brother Printer", properties={}
host="mock_host",
hostname="example.local.",
name="Brother Printer",
port=None,
properties={},
type="mock_type",
),
)

Expand All @@ -160,9 +165,12 @@ async def test_zeroconf_unsupported_model(hass):
DOMAIN,
context={"source": SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
host="mock_host",
hostname="example.local.",
name="Brother Printer",
port=None,
properties={"product": "MFC-8660DN"},
type="mock_type",
),
)

Expand All @@ -185,7 +193,12 @@ async def test_zeroconf_device_exists_abort(hass):
DOMAIN,
context={"source": SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
hostname="example.local.", name="Brother Printer", properties={}
host="mock_host",
hostname="example.local.",
name="Brother Printer",
port=None,
properties={},
type="mock_type",
),
)

Expand All @@ -202,7 +215,12 @@ async def test_zeroconf_no_probe_existing_device(hass):
DOMAIN,
context={"source": SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
hostname="localhost", name="Brother Printer"
host="mock_host",
hostname="localhost",
name="Brother Printer",
port=None,
properties={},
type="mock_type",
),
)
await hass.async_block_till_done()
Expand All @@ -223,7 +241,12 @@ async def test_zeroconf_confirm_create_entry(hass):
DOMAIN,
context={"source": SOURCE_ZEROCONF},
data=zeroconf.ZeroconfServiceInfo(
hostname="example.local.", name="Brother Printer", properties={}
host="mock_host",
hostname="example.local.",
name="Brother Printer",
port=None,
properties={},
type="mock_type",
),
)

Expand Down
13 changes: 12 additions & 1 deletion tests/components/daikin/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,18 @@ async def test_api_password_abort(hass):
@pytest.mark.parametrize(
"source, data, unique_id",
[
(SOURCE_ZEROCONF, zeroconf.ZeroconfServiceInfo(host=HOST), MAC),
(
SOURCE_ZEROCONF,
zeroconf.ZeroconfServiceInfo(
host=HOST,
hostname="mock_hostname",
name="mock_name",
port=None,
properties={},
type="mock_type",
),
MAC,
),
],
)
async def test_discovery_zeroconf(
Expand Down
16 changes: 14 additions & 2 deletions tests/components/devolo_home_control/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,19 @@
)

DISCOVERY_INFO_WRONG_DEVOLO_DEVICE = zeroconf.ZeroconfServiceInfo(
properties={"MT": "2700"}
host="mock_host",
hostname="mock_hostname",
name="mock_name",
port=None,
properties={"MT": "2700"},
type="mock_type",
)

DISCOVERY_INFO_WRONG_DEVICE = zeroconf.ZeroconfServiceInfo(properties={"Features": ""})
DISCOVERY_INFO_WRONG_DEVICE = zeroconf.ZeroconfServiceInfo(
host="mock_host",
hostname="mock_hostname",
name="mock_name",
port=None,
properties={"Features": ""},
type="mock_type",
)
9 changes: 8 additions & 1 deletion tests/components/devolo_home_network/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@
},
)

DISCOVERY_INFO_WRONG_DEVICE = zeroconf.ZeroconfServiceInfo(properties={"MT": "2600"})
DISCOVERY_INFO_WRONG_DEVICE = zeroconf.ZeroconfServiceInfo(
host="mock_host",
hostname="mock_hostname",
name="mock_name",
port=None,
properties={"MT": "2600"},
type="mock_type",
)

NEIGHBOR_ACCESS_POINTS = {
"neighbor_aps": [
Expand Down
Loading