fix zeroconf tests

This commit is contained in:
J. Nick Koston
2023-02-15 14:57:10 -06:00
parent 57a8a83cd2
commit b608d413a5
2 changed files with 18 additions and 11 deletions

View File

@@ -542,7 +542,7 @@ async def test_homekit_match_partial_space(hass, mock_async_zeroconf):
clear=True, clear=True,
), patch.dict( ), patch.dict(
zc_gen.HOMEKIT, zc_gen.HOMEKIT,
{"LIFX": "lifx"}, {"LIFX": {"domain": "lifx", "iot_class": "local_polling"}},
clear=True, clear=True,
), patch.object( ), patch.object(
hass.config_entries.flow, "async_init" hass.config_entries.flow, "async_init"
@@ -578,7 +578,7 @@ async def test_device_with_invalid_name(hass, mock_async_zeroconf, caplog):
clear=True, clear=True,
), patch.dict( ), patch.dict(
zc_gen.HOMEKIT, zc_gen.HOMEKIT,
{"LIFX": "lifx"}, {"LIFX": {"domain": "lifx", "iot_class": "local_polling"}},
clear=True, clear=True,
), patch.object( ), patch.object(
hass.config_entries.flow, "async_init" hass.config_entries.flow, "async_init"
@@ -609,7 +609,7 @@ async def test_homekit_match_partial_dash(hass, mock_async_zeroconf):
clear=True, clear=True,
), patch.dict( ), patch.dict(
zc_gen.HOMEKIT, zc_gen.HOMEKIT,
{"Smart Bridge": "lutron_caseta"}, {"Smart Bridge": {"domain": "lutron_caseta", "iot_class": "local_push"}},
clear=True, clear=True,
), patch.object( ), patch.object(
hass.config_entries.flow, "async_init" hass.config_entries.flow, "async_init"
@@ -638,7 +638,11 @@ async def test_homekit_match_partial_fnmatch(hass, mock_async_zeroconf):
zc_gen.ZEROCONF, zc_gen.ZEROCONF,
{"_hap._tcp.local.": [{"domain": "homekit_controller"}]}, {"_hap._tcp.local.": [{"domain": "homekit_controller"}]},
clear=True, clear=True,
), patch.dict(zc_gen.HOMEKIT, {"YLDP*": "yeelight"}, clear=True), patch.object( ), patch.dict(
zc_gen.HOMEKIT,
{"YLDP*": {"domain": "yeelight", "iot_class": "local_push"}},
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, zeroconf,
@@ -667,7 +671,7 @@ async def test_homekit_match_full(hass, mock_async_zeroconf):
clear=True, clear=True,
), patch.dict( ), patch.dict(
zc_gen.HOMEKIT, zc_gen.HOMEKIT,
{"BSB002": "hue"}, {"BSB002": {"domain": "hue", "iot_class": "local_push"}},
clear=True, clear=True,
), patch.object( ), patch.object(
hass.config_entries.flow, "async_init" hass.config_entries.flow, "async_init"
@@ -698,7 +702,10 @@ async def test_homekit_already_paired(hass, mock_async_zeroconf):
clear=True, clear=True,
), patch.dict( ), patch.dict(
zc_gen.HOMEKIT, zc_gen.HOMEKIT,
{"AC02": "tado", "tado": "tado"}, {
"AC02": {"domain": "tado", "iot_class": "cloud_polling"},
"tado": {"domain": "tado", "iot_class": "cloud_polling"},
},
clear=True, clear=True,
), patch.object( ), patch.object(
hass.config_entries.flow, "async_init" hass.config_entries.flow, "async_init"
@@ -730,7 +737,7 @@ async def test_homekit_invalid_paring_status(hass, mock_async_zeroconf):
clear=True, clear=True,
), patch.dict( ), patch.dict(
zc_gen.HOMEKIT, zc_gen.HOMEKIT,
{"Smart Bridge": "lutron_caseta"}, {"Smart Bridge": {"domain": "lutron_caseta", "iot_class": "local_push"}},
clear=True, clear=True,
), patch.object( ), patch.object(
hass.config_entries.flow, "async_init" hass.config_entries.flow, "async_init"
@@ -794,7 +801,7 @@ async def test_homekit_controller_still_discovered_unpaired_for_cloud(
clear=True, clear=True,
), patch.dict( ), patch.dict(
zc_gen.HOMEKIT, zc_gen.HOMEKIT,
{"Rachio": "rachio"}, {"Rachio": {"domain": "rachio", "iot_class": "cloud_push"}},
clear=True, clear=True,
), patch.object( ), patch.object(
hass.config_entries.flow, "async_init" hass.config_entries.flow, "async_init"
@@ -834,7 +841,7 @@ async def test_homekit_controller_still_discovered_unpaired_for_polling(
clear=True, clear=True,
), patch.dict( ), patch.dict(
zc_gen.HOMEKIT, zc_gen.HOMEKIT,
{"iSmartGate": "gogogate2"}, {"iSmartGate": {"domain": "gogogate2", "iot_class": "local_polling"}},
clear=True, clear=True,
), patch.object( ), patch.object(
hass.config_entries.flow, "async_init" hass.config_entries.flow, "async_init"

View File

@@ -623,8 +623,8 @@ async def test_get_homekit(hass: HomeAssistant) -> None:
"test_2": test_2_integration, "test_2": test_2_integration,
} }
homekit = await loader.async_get_homekit(hass) homekit = await loader.async_get_homekit(hass)
assert homekit["test_1"] == "test_1" assert homekit["test_1"] == loader.HomeKitDiscoveredIntegration("test_1", None)
assert homekit["test_2"] == "test_2" assert homekit["test_2"] == loader.HomeKitDiscoveredIntegration("test_2", None)
async def test_get_ssdp(hass: HomeAssistant) -> None: async def test_get_ssdp(hass: HomeAssistant) -> None: