31 lines
851 B
Python
31 lines
851 B
Python
"""Define fixtures available for all Acmeda tests."""
|
|
|
|
from collections.abc import Generator
|
|
from unittest.mock import AsyncMock, patch
|
|
|
|
import pytest
|
|
|
|
from homeassistant.components.acmeda.const import DOMAIN
|
|
from homeassistant.const import CONF_HOST
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from tests.common import MockConfigEntry
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_config_entry(hass: HomeAssistant) -> MockConfigEntry:
|
|
"""Return the default mocked config entry."""
|
|
mock_config_entry = MockConfigEntry(
|
|
domain=DOMAIN,
|
|
data={CONF_HOST: "127.0.0.1"},
|
|
)
|
|
mock_config_entry.add_to_hass(hass)
|
|
return mock_config_entry
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_hub_run() -> Generator[AsyncMock]:
|
|
"""Mock the hub run method."""
|
|
with patch("homeassistant.components.acmeda.hub.aiopulse.Hub.run") as mock_run:
|
|
yield mock_run
|