Support homekit matches that have a dash after the model (#33274)
parent
f5a6c3484d
commit
f93e4e3de7
|
@ -132,7 +132,11 @@ def handle_homekit(hass, info) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
for test_model in HOMEKIT:
|
for test_model in HOMEKIT:
|
||||||
if model != test_model and not model.startswith(test_model + " "):
|
if (
|
||||||
|
model != test_model
|
||||||
|
and not model.startswith(test_model + " ")
|
||||||
|
and not model.startswith(test_model + "-")
|
||||||
|
):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
hass.add_job(
|
hass.add_job(
|
||||||
|
|
|
@ -68,7 +68,7 @@ async def test_setup(hass, mock_zeroconf):
|
||||||
assert len(mock_config_flow.mock_calls) == expected_flow_calls * 2
|
assert len(mock_config_flow.mock_calls) == expected_flow_calls * 2
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_match_partial(hass, mock_zeroconf):
|
async def test_homekit_match_partial_space(hass, mock_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.dict(
|
with patch.dict(
|
||||||
zc_gen.ZEROCONF, {zeroconf.HOMEKIT_TYPE: ["homekit_controller"]}, clear=True
|
zc_gen.ZEROCONF, {zeroconf.HOMEKIT_TYPE: ["homekit_controller"]}, clear=True
|
||||||
|
@ -83,6 +83,23 @@ async def test_homekit_match_partial(hass, mock_zeroconf):
|
||||||
assert mock_config_flow.mock_calls[0][1][0] == "lifx"
|
assert mock_config_flow.mock_calls[0][1][0] == "lifx"
|
||||||
|
|
||||||
|
|
||||||
|
async def test_homekit_match_partial_dash(hass, mock_zeroconf):
|
||||||
|
"""Test configured options for a device are loaded via config entry."""
|
||||||
|
with patch.dict(
|
||||||
|
zc_gen.ZEROCONF, {zeroconf.HOMEKIT_TYPE: ["homekit_controller"]}, clear=True
|
||||||
|
), patch.object(hass.config_entries, "flow") as mock_config_flow, patch.object(
|
||||||
|
zeroconf, "ServiceBrowser", side_effect=service_update_mock
|
||||||
|
) as mock_service_browser:
|
||||||
|
mock_zeroconf.get_service_info.side_effect = get_homekit_info_mock(
|
||||||
|
"Rachio-fa46ba"
|
||||||
|
)
|
||||||
|
assert await async_setup_component(hass, zeroconf.DOMAIN, {zeroconf.DOMAIN: {}})
|
||||||
|
|
||||||
|
assert len(mock_service_browser.mock_calls) == 1
|
||||||
|
assert len(mock_config_flow.mock_calls) == 2
|
||||||
|
assert mock_config_flow.mock_calls[0][1][0] == "rachio"
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_match_full(hass, mock_zeroconf):
|
async def test_homekit_match_full(hass, mock_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.dict(
|
with patch.dict(
|
||||||
|
|
Loading…
Reference in New Issue