Add type hints for ClientSessionGenerator in test fixtures (#118689)
parent
77c627e6f3
commit
fdec1b0b16
|
@ -18,6 +18,9 @@ from homeassistant.core import HomeAssistant
|
|||
from homeassistant.helpers import config_entry_oauth2_flow
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
CLIENT_ID = "1234"
|
||||
CLIENT_SECRET = "5678"
|
||||
|
||||
|
@ -33,12 +36,11 @@ async def setup_credentials(hass: HomeAssistant) -> None:
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("current_request_with_host", "setup_credentials")
|
||||
async def test_full_flow(
|
||||
hass: HomeAssistant,
|
||||
hass_client_no_auth,
|
||||
aioclient_mock,
|
||||
current_request_with_host,
|
||||
setup_credentials,
|
||||
hass_client_no_auth: ClientSessionGenerator,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
) -> None:
|
||||
"""Check full flow."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
|
|
@ -7,7 +7,6 @@ from typing import Any
|
|||
import urllib
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from aiohttp import ClientSession
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
import pytest
|
||||
|
||||
|
@ -115,7 +114,7 @@ def mock_insert_schedule_response(
|
|||
|
||||
@pytest.fixture(name="get_events")
|
||||
def get_events_fixture(
|
||||
hass_client: Callable[..., Awaitable[ClientSession]],
|
||||
hass_client: ClientSessionGenerator,
|
||||
) -> GetEventsFn:
|
||||
"""Fetch calendar events from the HTTP API."""
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
from http import HTTPStatus
|
||||
from unittest.mock import patch
|
||||
|
||||
from aiohttp.test_utils import TestClient
|
||||
import pytest
|
||||
|
||||
from homeassistant import config_entries
|
||||
|
@ -17,6 +18,8 @@ from homeassistant.helpers import device_registry as dr, entity_registry as er
|
|||
from homeassistant.helpers.dispatcher import DATA_DISPATCHER
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
HOME_LATITUDE = 37.239622
|
||||
HOME_LONGITUDE = -115.815811
|
||||
|
||||
|
@ -27,7 +30,9 @@ def mock_dev_track(mock_device_tracker_conf):
|
|||
|
||||
|
||||
@pytest.fixture(name="client")
|
||||
async def traccar_client(hass, hass_client_no_auth):
|
||||
async def traccar_client(
|
||||
hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator
|
||||
) -> TestClient:
|
||||
"""Mock client for Traccar (unauthenticated)."""
|
||||
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
|
||||
|
|
Loading…
Reference in New Issue