Add type hints to integration tests (a) (#87684)

* Add type hints to accuweather tests

* Adjust a** components

* Adjust aiohttp_client

* ClientSessionGenerator/WebSocketGenerator
This commit is contained in:
epenet 2023-02-08 12:16:23 +01:00 committed by GitHub
parent 7665c89b83
commit 2545694d41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
79 changed files with 720 additions and 425 deletions

View file

@ -17,11 +17,12 @@ from homeassistant.components.august.exceptions import (
RequireValidation,
)
from homeassistant.const import CONF_PASSWORD, CONF_TIMEOUT, CONF_USERNAME
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry
async def test_form(hass):
async def test_form(hass: HomeAssistant) -> None:
"""Test we get the form."""
result = await hass.config_entries.flow.async_init(
@ -58,7 +59,7 @@ async def test_form(hass):
assert len(mock_setup_entry.mock_calls) == 1
async def test_form_invalid_auth(hass):
async def test_form_invalid_auth(hass: HomeAssistant) -> None:
"""Test we handle invalid auth."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
@ -81,7 +82,7 @@ async def test_form_invalid_auth(hass):
assert result2["errors"] == {"base": "invalid_auth"}
async def test_user_unexpected_exception(hass):
async def test_user_unexpected_exception(hass: HomeAssistant) -> None:
"""Test we handle an unexpected exception."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
@ -104,7 +105,7 @@ async def test_user_unexpected_exception(hass):
assert result2["errors"] == {"base": "unknown"}
async def test_form_cannot_connect(hass):
async def test_form_cannot_connect(hass: HomeAssistant) -> None:
"""Test we handle cannot connect error."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
@ -127,7 +128,7 @@ async def test_form_cannot_connect(hass):
assert result2["errors"] == {"base": "cannot_connect"}
async def test_form_needs_validate(hass):
async def test_form_needs_validate(hass: HomeAssistant) -> None:
"""Test we present validation when we need to validate."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
@ -212,7 +213,7 @@ async def test_form_needs_validate(hass):
assert len(mock_setup_entry.mock_calls) == 1
async def test_form_reauth(hass):
async def test_form_reauth(hass: HomeAssistant) -> None:
"""Test reauthenticate."""
entry = MockConfigEntry(
@ -255,7 +256,7 @@ async def test_form_reauth(hass):
assert len(mock_setup_entry.mock_calls) == 1
async def test_form_reauth_with_2fa(hass):
async def test_form_reauth_with_2fa(hass: HomeAssistant) -> None:
"""Test reauthenticate with 2fa."""
entry = MockConfigEntry(