mirror of
https://github.com/home-assistant/core.git
synced 2025-11-14 13:30:43 +00:00
Mock out network.util.async_get_source_ip in tests (#55592)
This commit is contained in:
@@ -102,6 +102,13 @@ def always_patch_driver(hk_driver):
|
||||
"""Load the hk_driver fixture."""
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def patch_source_ip(mock_get_source_ip):
|
||||
"""Patch homeassistant and pyhap functions for getting local address."""
|
||||
with patch("pyhap.util.get_local_address", return_value="10.10.10.10"):
|
||||
yield
|
||||
|
||||
|
||||
def _mock_homekit(hass, entry, homekit_mode, entity_filter=None, devices=None):
|
||||
return HomeKit(
|
||||
hass=hass,
|
||||
@@ -1301,7 +1308,7 @@ async def test_homekit_uses_system_zeroconf(hass, hk_driver, mock_zeroconf):
|
||||
|
||||
with patch("pyhap.accessory_driver.AccessoryDriver.async_start"), patch(
|
||||
f"{PATH_HOMEKIT}.HomeKit.async_stop"
|
||||
):
|
||||
), patch(f"{PATH_HOMEKIT}.port_is_available"):
|
||||
entry.add_to_hass(hass)
|
||||
assert await hass.config_entries.async_setup(entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
Reference in New Issue
Block a user