Fix homekit test mocking missed in loop changeover (#37628)

This commit is contained in:
J. Nick Koston 2020-07-07 17:14:58 -05:00 committed by GitHub
parent 4c2b12d8f1
commit 3871688dfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -785,7 +785,7 @@ async def test_homekit_finds_linked_batteries(
with patch.object(homekit.bridge, "add_accessory"), patch( with patch.object(homekit.bridge, "add_accessory"), patch(
f"{PATH_HOMEKIT}.show_setup_message" f"{PATH_HOMEKIT}.show_setup_message"
), patch(f"{PATH_HOMEKIT}.get_accessory") as mock_get_acc, patch( ), patch(f"{PATH_HOMEKIT}.get_accessory") as mock_get_acc, patch(
"pyhap.accessory_driver.AccessoryDriver.start" "pyhap.accessory_driver.AccessoryDriver.start_service"
): ):
await homekit.async_start() await homekit.async_start()
await hass.async_block_till_done() await hass.async_block_till_done()
@ -932,10 +932,14 @@ async def test_homekit_uses_system_zeroconf(hass, hk_driver, mock_zeroconf):
) )
system_zc = await zeroconf.async_get_instance(hass) system_zc = await zeroconf.async_get_instance(hass)
with patch("pyhap.accessory_driver.AccessoryDriver.start_service"), patch(
f"{PATH_HOMEKIT}.HomeKit.async_stop"
):
entry.add_to_hass(hass) entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(entry.entry_id) assert await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done() await hass.async_block_till_done()
assert hass.data[DOMAIN][entry.entry_id][HOMEKIT].driver.advertiser == system_zc assert hass.data[DOMAIN][entry.entry_id][HOMEKIT].driver.advertiser == system_zc
assert await hass.config_entries.async_unload(entry.entry_id)
await hass.async_block_till_done() await hass.async_block_till_done()
@ -1008,7 +1012,7 @@ async def test_homekit_ignored_missing_devices(
with patch.object(homekit.bridge, "add_accessory"), patch( with patch.object(homekit.bridge, "add_accessory"), patch(
f"{PATH_HOMEKIT}.show_setup_message" f"{PATH_HOMEKIT}.show_setup_message"
), patch(f"{PATH_HOMEKIT}.get_accessory") as mock_get_acc, patch( ), patch(f"{PATH_HOMEKIT}.get_accessory") as mock_get_acc, patch(
"pyhap.accessory_driver.AccessoryDriver.start" "pyhap.accessory_driver.AccessoryDriver.start_service"
): ):
await homekit.async_start() await homekit.async_start()
await hass.async_block_till_done() await hass.async_block_till_done()
@ -1082,7 +1086,7 @@ async def test_homekit_finds_linked_motion_sensors(
with patch.object(homekit.bridge, "add_accessory"), patch( with patch.object(homekit.bridge, "add_accessory"), patch(
f"{PATH_HOMEKIT}.show_setup_message" f"{PATH_HOMEKIT}.show_setup_message"
), patch(f"{PATH_HOMEKIT}.get_accessory") as mock_get_acc, patch( ), patch(f"{PATH_HOMEKIT}.get_accessory") as mock_get_acc, patch(
"pyhap.accessory_driver.AccessoryDriver.start" "pyhap.accessory_driver.AccessoryDriver.start_service"
): ):
await homekit.async_start() await homekit.async_start()
await hass.async_block_till_done() await hass.async_block_till_done()
@ -1159,7 +1163,7 @@ async def test_homekit_finds_linked_humidity_sensors(
with patch.object(homekit.bridge, "add_accessory"), patch( with patch.object(homekit.bridge, "add_accessory"), patch(
f"{PATH_HOMEKIT}.show_setup_message" f"{PATH_HOMEKIT}.show_setup_message"
), patch(f"{PATH_HOMEKIT}.get_accessory") as mock_get_acc, patch( ), patch(f"{PATH_HOMEKIT}.get_accessory") as mock_get_acc, patch(
"pyhap.accessory_driver.AccessoryDriver.start" "pyhap.accessory_driver.AccessoryDriver.start_service"
): ):
await homekit.async_start() await homekit.async_start()
await hass.async_block_till_done() await hass.async_block_till_done()