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,12 @@
"""Test the SQL config flow."""
from __future__ import annotations
from unittest.mock import AsyncMock, patch
from unittest.mock import patch
from sqlalchemy.exc import SQLAlchemyError
from homeassistant import config_entries
from homeassistant.components.recorder import DEFAULT_DB_FILE, DEFAULT_URL
from homeassistant.components.recorder import DEFAULT_DB_FILE, DEFAULT_URL, Recorder
from homeassistant.components.sql.const import DOMAIN
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResultType
@ -21,7 +21,7 @@ from . import (
from tests.common import MockConfigEntry
async def test_form(recorder_mock: AsyncMock, hass: HomeAssistant) -> None:
async def test_form(recorder_mock: Recorder, hass: HomeAssistant) -> None:
"""Test we get the form."""
result = await hass.config_entries.flow.async_init(
@ -53,7 +53,7 @@ async def test_form(recorder_mock: AsyncMock, hass: HomeAssistant) -> None:
assert len(mock_setup_entry.mock_calls) == 1
async def test_flow_fails_db_url(recorder_mock: AsyncMock, hass: HomeAssistant) -> None:
async def test_flow_fails_db_url(recorder_mock: Recorder, hass: HomeAssistant) -> None:
"""Test config flow fails incorrect db url."""
result4 = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
@ -75,7 +75,7 @@ async def test_flow_fails_db_url(recorder_mock: AsyncMock, hass: HomeAssistant)
async def test_flow_fails_invalid_query(
recorder_mock: AsyncMock, hass: HomeAssistant
recorder_mock: Recorder, hass: HomeAssistant
) -> None:
"""Test config flow fails incorrect db url."""
result4 = await hass.config_entries.flow.async_init(
@ -122,7 +122,7 @@ async def test_flow_fails_invalid_query(
}
async def test_options_flow(recorder_mock: AsyncMock, hass: HomeAssistant) -> None:
async def test_options_flow(recorder_mock: Recorder, hass: HomeAssistant) -> None:
"""Test options config flow."""
entry = MockConfigEntry(
domain=DOMAIN,
@ -171,7 +171,7 @@ async def test_options_flow(recorder_mock: AsyncMock, hass: HomeAssistant) -> No
async def test_options_flow_name_previously_removed(
recorder_mock: AsyncMock, hass: HomeAssistant
recorder_mock: Recorder, hass: HomeAssistant
) -> None:
"""Test options config flow where the name was missing."""
entry = MockConfigEntry(
@ -223,7 +223,7 @@ async def test_options_flow_name_previously_removed(
async def test_options_flow_fails_db_url(
recorder_mock: AsyncMock, hass: HomeAssistant
recorder_mock: Recorder, hass: HomeAssistant
) -> None:
"""Test options flow fails incorrect db url."""
entry = MockConfigEntry(
@ -267,7 +267,7 @@ async def test_options_flow_fails_db_url(
async def test_options_flow_fails_invalid_query(
recorder_mock: AsyncMock, hass: HomeAssistant
recorder_mock: Recorder, hass: HomeAssistant
) -> None:
"""Test options flow fails incorrect query and template."""
entry = MockConfigEntry(
@ -324,7 +324,7 @@ async def test_options_flow_fails_invalid_query(
async def test_options_flow_db_url_empty(
recorder_mock: AsyncMock, hass: HomeAssistant
recorder_mock: Recorder, hass: HomeAssistant
) -> None:
"""Test options config flow with leaving db_url empty."""
entry = MockConfigEntry(