Mock out network.util.async_get_source_ip in tests (#56339)
parent
0830100df1
commit
be0819b456
|
@ -29,6 +29,6 @@ def recorder_url_mock():
|
|||
yield
|
||||
|
||||
|
||||
async def test_setup(hass, mock_zeroconf):
|
||||
async def test_setup(hass, mock_zeroconf, mock_get_source_ip):
|
||||
"""Test setup."""
|
||||
assert await async_setup_component(hass, "default_config", {"foo": "bar"})
|
||||
|
|
|
@ -14,7 +14,7 @@ from homeassistant.setup import async_setup_component
|
|||
from tests.components.logbook.test_init import MockLazyEventPartialState
|
||||
|
||||
|
||||
async def test_humanify_homekit_changed_event(hass, hk_driver):
|
||||
async def test_humanify_homekit_changed_event(hass, hk_driver, mock_get_source_ip):
|
||||
"""Test humanifying HomeKit changed event."""
|
||||
hass.config.components.add("recorder")
|
||||
with patch("homeassistant.components.homekit.HomeKit"):
|
||||
|
|
|
@ -238,7 +238,7 @@ def test_density_to_air_quality():
|
|||
assert density_to_air_quality(300) == 5
|
||||
|
||||
|
||||
async def test_show_setup_msg(hass, hk_driver):
|
||||
async def test_show_setup_msg(hass, hk_driver, mock_get_source_ip):
|
||||
"""Test show setup message as persistence notification."""
|
||||
pincode = b"123-45-678"
|
||||
|
||||
|
|
|
@ -202,3 +202,9 @@ def alarm_event_fixture(soco):
|
|||
}
|
||||
|
||||
return SonosMockEvent(soco, soco.alarmClock, variables)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_get_source_ip(mock_get_source_ip):
|
||||
"""Mock network util's async_get_source_ip in all sonos tests."""
|
||||
return mock_get_source_ip
|
||||
|
|
Loading…
Reference in New Issue