Add type hints for hass_storage in test fixtures (#118682)

This commit is contained in:
epenet 2024-06-03 10:20:57 +02:00 committed by GitHub
parent fdec1b0b16
commit f39dd40be1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,7 @@
"""Test configuration and mocks for the SmartThings component."""
import secrets
from typing import Any
from unittest.mock import Mock, patch
from uuid import uuid4
@ -45,6 +46,7 @@ from homeassistant.const import (
CONF_CLIENT_SECRET,
CONF_WEBHOOK_ID,
)
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
from tests.common import MockConfigEntry
@ -74,7 +76,9 @@ async def setup_platform(hass, platform: str, *, devices=None, scenes=None):
@pytest.fixture(autouse=True)
async def setup_component(hass, config_file, hass_storage):
async def setup_component(
hass: HomeAssistant, config_file: dict[str, str], hass_storage: dict[str, Any]
) -> None:
"""Load the SmartThing component."""
hass_storage[STORAGE_KEY] = {"data": config_file, "version": STORAGE_VERSION}
await async_process_ha_core_config(
@ -166,7 +170,7 @@ def installed_apps_fixture(installed_app, locations, app):
@pytest.fixture(name="config_file")
def config_file_fixture():
def config_file_fixture() -> dict[str, str]:
"""Fixture representing the local config file contents."""
return {CONF_INSTANCE_ID: str(uuid4()), CONF_WEBHOOK_ID: secrets.token_hex()}

View File

@ -55,7 +55,7 @@ def storage_setup(hass: HomeAssistant, hass_storage: dict[str, Any]):
@pytest.fixture
def storage_setup_1_1(hass: HomeAssistant, hass_storage):
def storage_setup_1_1(hass: HomeAssistant, hass_storage: dict[str, Any]):
"""Storage version 1.1 setup."""
async def _storage(items=None):
@ -87,7 +87,7 @@ async def test_migration(
hass_ws_client: WebSocketGenerator,
storage_setup_1_1,
freezer: FrozenDateTimeFactory,
hass_storage,
hass_storage: dict[str, Any],
snapshot: SnapshotAssertion,
) -> None:
"""Test migrating tag store."""