mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Fix zeroconf tests (#71557)
This commit is contained in:
parent
9ef5c23f1c
commit
cec7e53302
@ -147,7 +147,17 @@ def get_zeroconf_info_mock_model(model):
|
|||||||
|
|
||||||
async def test_setup(hass, mock_async_zeroconf):
|
async def test_setup(hass, mock_async_zeroconf):
|
||||||
"""Test configured options for a device are loaded via config entry."""
|
"""Test configured options for a device are loaded via config entry."""
|
||||||
with patch.object(
|
mock_zc = {
|
||||||
|
"_http._tcp.local.": [
|
||||||
|
{
|
||||||
|
"domain": "shelly",
|
||||||
|
"name": "shelly*",
|
||||||
|
"properties": {"macaddress": "ffaadd*"},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_Volumio._tcp.local.": [{"domain": "volumio"}],
|
||||||
|
}
|
||||||
|
with patch.dict(zc_gen.ZEROCONF, mock_zc, clear=True,), patch.object(
|
||||||
hass.config_entries.flow, "async_init"
|
hass.config_entries.flow, "async_init"
|
||||||
) as mock_config_flow, patch.object(
|
) as mock_config_flow, patch.object(
|
||||||
zeroconf, "HaAsyncServiceBrowser", side_effect=service_update_mock
|
zeroconf, "HaAsyncServiceBrowser", side_effect=service_update_mock
|
||||||
@ -161,7 +171,7 @@ async def test_setup(hass, mock_async_zeroconf):
|
|||||||
|
|
||||||
assert len(mock_service_browser.mock_calls) == 1
|
assert len(mock_service_browser.mock_calls) == 1
|
||||||
expected_flow_calls = 0
|
expected_flow_calls = 0
|
||||||
for matching_components in zc_gen.ZEROCONF.values():
|
for matching_components in mock_zc.values():
|
||||||
domains = set()
|
domains = set()
|
||||||
for component in matching_components:
|
for component in matching_components:
|
||||||
if len(component) == 1:
|
if len(component) == 1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user