2020-10-23 16:28:21 +02:00
|
|
|
"""template conftest."""
|
2024-03-08 19:16:21 +01:00
|
|
|
|
2021-08-24 14:11:40 +02:00
|
|
|
import pytest
|
|
|
|
|
2024-05-29 09:30:41 +02:00
|
|
|
from homeassistant.core import HomeAssistant, ServiceCall
|
2021-08-24 14:11:40 +02:00
|
|
|
from homeassistant.setup import async_setup_component
|
|
|
|
|
|
|
|
from tests.common import assert_setup_component, async_mock_service
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2024-05-29 09:30:41 +02:00
|
|
|
def calls(hass: HomeAssistant) -> list[ServiceCall]:
|
2021-08-24 14:11:40 +02:00
|
|
|
"""Track calls to a mock service."""
|
|
|
|
return async_mock_service(hass, "test", "automation")
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2024-05-29 14:10:00 +02:00
|
|
|
async def start_ha(
|
|
|
|
hass: HomeAssistant, count, domain, config, caplog: pytest.LogCaptureFixture
|
|
|
|
):
|
2021-08-24 14:11:40 +02: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 16:09:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2024-05-29 14:10:00 +02:00
|
|
|
async def caplog_setup_text(caplog: pytest.LogCaptureFixture) -> str:
|
2021-09-04 16:09:55 +02:00
|
|
|
"""Return setup log of integration."""
|
2023-01-27 13:57:06 +01:00
|
|
|
return caplog.text
|