2020-10-23 14:28:21 +00:00
|
|
|
"""template conftest."""
|
2024-03-08 18:16:21 +00:00
|
|
|
|
2021-08-24 12:11:40 +00:00
|
|
|
import pytest
|
|
|
|
|
2024-05-29 07:30:41 +00:00
|
|
|
from homeassistant.core import HomeAssistant, ServiceCall
|
2024-09-26 12:00:52 +00:00
|
|
|
from homeassistant.helpers.typing import ConfigType
|
2021-08-24 12:11:40 +00:00
|
|
|
from homeassistant.setup import async_setup_component
|
|
|
|
|
|
|
|
from tests.common import assert_setup_component, async_mock_service
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2024-05-29 07:30:41 +00:00
|
|
|
def calls(hass: HomeAssistant) -> list[ServiceCall]:
|
2021-08-24 12:11:40 +00:00
|
|
|
"""Track calls to a mock service."""
|
|
|
|
return async_mock_service(hass, "test", "automation")
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2024-05-29 12:10:00 +00:00
|
|
|
async def start_ha(
|
2024-09-26 12:00:52 +00:00
|
|
|
hass: HomeAssistant, count: int, domain: str, config: ConfigType
|
|
|
|
) -> None:
|
2021-08-24 12:11:40 +00:00
|
|
|
"""Do setup of integration."""
|
|
|
|
with assert_setup_component(count, domain):
|
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
domain,
|
|
|
|
config,
|
|
|
|
)
|
|
|
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
await hass.async_start()
|
|
|
|
await hass.async_block_till_done()
|
2021-09-04 14:09:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2024-05-29 12:10:00 +00:00
|
|
|
async def caplog_setup_text(caplog: pytest.LogCaptureFixture) -> str:
|
2021-09-04 14:09:55 +00:00
|
|
|
"""Return setup log of integration."""
|
2023-01-27 12:57:06 +00:00
|
|
|
return caplog.text
|
2024-10-04 14:47:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(autouse=True, name="stub_blueprint_populate")
|
|
|
|
def stub_blueprint_populate_autouse(stub_blueprint_populate: None) -> None:
|
|
|
|
"""Stub copying the blueprints to the config folder."""
|