hass-core/tests/components/devolo_home_control/conftest.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
1.1 KiB
Python
Raw Normal View History

"""Fixtures for tests."""
from unittest.mock import MagicMock, patch
import pytest
from typing_extensions import Generator
@pytest.fixture
def credentials_valid() -> bool:
"""Mark test as credentials invalid."""
return True
@pytest.fixture
def maintenance() -> bool:
"""Mark test as maintenance mode on."""
return False
@pytest.fixture(autouse=True)
def patch_mydevolo(credentials_valid: bool, maintenance: bool) -> Generator[None]:
"""Fixture to patch mydevolo into a desired state."""
with (
patch(
"homeassistant.components.devolo_home_control.Mydevolo.credentials_valid",
return_value=credentials_valid,
),
patch(
"homeassistant.components.devolo_home_control.Mydevolo.maintenance",
return_value=maintenance,
),
patch(
"homeassistant.components.devolo_home_control.Mydevolo.get_gateway_ids",
return_value=["1400000000000001", "1400000000000002"],
),
):
yield
2021-11-18 22:23:20 -06:00
@pytest.fixture(autouse=True)
def devolo_home_control_mock_async_zeroconf(mock_async_zeroconf: MagicMock) -> None:
2021-11-18 22:23:20 -06:00
"""Auto mock zeroconf."""