Add type hints to integration tests (part 21) (#88233)

This commit is contained in:
epenet 2023-02-16 11:15:26 +01:00 committed by GitHub
parent 0748e12341
commit dab8557951
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 536 additions and 328 deletions

View file

@ -1,12 +1,13 @@
"""Test for SQL component Init."""
from __future__ import annotations
from unittest.mock import AsyncMock, patch
from unittest.mock import patch
import pytest
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.recorder import Recorder
from homeassistant.components.sql import validate_sql_select
from homeassistant.components.sql.const import DOMAIN
from homeassistant.core import HomeAssistant
@ -15,13 +16,13 @@ from homeassistant.setup import async_setup_component
from . import YAML_CONFIG_INVALID, YAML_CONFIG_NO_DB, init_integration
async def test_setup_entry(recorder_mock: AsyncMock, hass: HomeAssistant) -> None:
async def test_setup_entry(recorder_mock: Recorder, hass: HomeAssistant) -> None:
"""Test setup entry."""
config_entry = await init_integration(hass)
assert config_entry.state == config_entries.ConfigEntryState.LOADED
async def test_unload_entry(recorder_mock: AsyncMock, hass: HomeAssistant) -> None:
async def test_unload_entry(recorder_mock: Recorder, hass: HomeAssistant) -> None:
"""Test unload an entry."""
config_entry = await init_integration(hass)
assert config_entry.state == config_entries.ConfigEntryState.LOADED
@ -31,7 +32,7 @@ async def test_unload_entry(recorder_mock: AsyncMock, hass: HomeAssistant) -> No
assert config_entry.state is config_entries.ConfigEntryState.NOT_LOADED
async def test_setup_config(recorder_mock: AsyncMock, hass: HomeAssistant) -> None:
async def test_setup_config(recorder_mock: Recorder, hass: HomeAssistant) -> None:
"""Test setup from yaml config."""
with patch(
"homeassistant.components.sql.config_flow.sqlalchemy.create_engine",
@ -41,7 +42,7 @@ async def test_setup_config(recorder_mock: AsyncMock, hass: HomeAssistant) -> No
async def test_setup_invalid_config(
recorder_mock: AsyncMock, hass: HomeAssistant
recorder_mock: Recorder, hass: HomeAssistant
) -> None:
"""Test setup from yaml with invalid config."""
with patch(