Fix type hints in google tests (#118941)
This commit is contained in:
parent
492b158818
commit
857b5c9c1b
3 changed files with 13 additions and 15 deletions
|
@ -92,14 +92,14 @@ CLIENT_ID = "client-id"
|
|||
CLIENT_SECRET = "client-secret"
|
||||
|
||||
|
||||
@pytest.fixture(name="calendar_access_role")
|
||||
def test_calendar_access_role() -> str:
|
||||
"""Default access role to use for test_api_calendar in tests."""
|
||||
@pytest.fixture
|
||||
def calendar_access_role() -> str:
|
||||
"""Set default access role to use for test_api_calendar in tests."""
|
||||
return "owner"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def test_api_calendar(calendar_access_role: str) -> None:
|
||||
@pytest.fixture(name="test_api_calendar")
|
||||
def api_calendar(calendar_access_role: str) -> dict[str, Any]:
|
||||
"""Return a test calendar object used in API responses."""
|
||||
return {
|
||||
**TEST_API_CALENDAR,
|
||||
|
|
|
@ -42,9 +42,9 @@ TEST_ENTITY_NAME = TEST_API_ENTITY_NAME
|
|||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_test_setup(
|
||||
test_api_calendar,
|
||||
mock_calendars_list,
|
||||
):
|
||||
test_api_calendar: dict[str, Any],
|
||||
mock_calendars_list: ApiResult,
|
||||
) -> None:
|
||||
"""Fixture that sets up the default API responses during integration setup."""
|
||||
mock_calendars_list({"items": [test_api_calendar]})
|
||||
|
||||
|
@ -447,9 +447,7 @@ async def test_http_event_api_failure(
|
|||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
component_setup,
|
||||
mock_calendars_list,
|
||||
mock_events_list,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
) -> None:
|
||||
"""Test the Rest API response during a calendar failure."""
|
||||
mock_events_list({}, exc=ClientError())
|
||||
|
@ -570,7 +568,7 @@ async def test_opaque_event(
|
|||
async def test_scan_calendar_error(
|
||||
hass: HomeAssistant,
|
||||
component_setup,
|
||||
mock_calendars_list,
|
||||
mock_calendars_list: ApiResult,
|
||||
config_entry,
|
||||
) -> None:
|
||||
"""Test that the calendar update handles a server error."""
|
||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.auth.models import Credentials
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .conftest import TEST_EVENT, ComponentSetup
|
||||
from .conftest import TEST_EVENT, ApiResult, ComponentSetup
|
||||
|
||||
from tests.common import CLIENT_ID, MockConfigEntry, MockUser
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
|
@ -23,9 +23,9 @@ from tests.typing import ClientSessionGenerator
|
|||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_test_setup(
|
||||
test_api_calendar,
|
||||
mock_calendars_list,
|
||||
):
|
||||
test_api_calendar: dict[str, Any],
|
||||
mock_calendars_list: ApiResult,
|
||||
) -> None:
|
||||
"""Fixture that sets up the default API responses during integration setup."""
|
||||
mock_calendars_list({"items": [test_api_calendar]})
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue