1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
"""Shared fixtures for aiohasupervisor tests."""
from collections.abc import AsyncGenerator, Generator
from aioresponses import aioresponses
import pytest
from aiohasupervisor import SupervisorClient
from .const import SUPERVISOR_URL
@pytest.fixture(name="supervisor_client")
async def client() -> AsyncGenerator[SupervisorClient, None]:
"""Return a Supervisor client."""
async with SupervisorClient(
SUPERVISOR_URL,
"abc123",
) as supervisor_client:
yield supervisor_client
@pytest.fixture(name="responses")
def aioresponses_fixture() -> Generator[aioresponses, None, None]:
"""Return aioresponses fixture."""
with aioresponses() as mocked_responses:
yield mocked_responses
|