2018-05-01 13:35:23 -04:00
|
|
|
"""Fixtures for component testing."""
|
2021-01-01 22:31:56 +01:00
|
|
|
from unittest.mock import patch
|
|
|
|
|
2018-05-01 13:35:23 -04:00
|
|
|
import pytest
|
|
|
|
|
2020-08-12 09:08:33 -05:00
|
|
|
|
2021-04-25 20:16:38 +02:00
|
|
|
@pytest.fixture(scope="session", autouse=True)
|
|
|
|
def patch_zeroconf_multiple_catcher():
|
|
|
|
"""Patch zeroconf wrapper that detects if multiple instances are used."""
|
|
|
|
with patch(
|
|
|
|
"homeassistant.components.zeroconf.install_multiple_zeroconf_catcher",
|
|
|
|
side_effect=lambda zc: None,
|
|
|
|
):
|
|
|
|
yield
|
2020-08-12 09:08:33 -05:00
|
|
|
|
2018-11-21 20:55:21 +01:00
|
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
|
|
def prevent_io():
|
|
|
|
"""Fixture to prevent certain I/O from happening."""
|
2019-07-31 12:25:30 -07:00
|
|
|
with patch(
|
2020-08-27 13:56:20 +02:00
|
|
|
"homeassistant.components.http.ban.async_load_ip_bans_config",
|
|
|
|
return_value=[],
|
2019-07-31 12:25:30 -07:00
|
|
|
):
|
2018-11-21 20:55:21 +01:00
|
|
|
yield
|