Add type hints to integration tests (b-c) (#87698)

This commit is contained in:
epenet 2023-02-08 18:08:43 +01:00 committed by GitHub
parent 1a414f1433
commit 807c69f621
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 548 additions and 350 deletions

View file

@ -14,6 +14,7 @@ from homeassistant.const import (
CONF_SCAN_INTERVAL,
CONF_USERNAME,
)
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry
@ -44,7 +45,7 @@ def _get_mock_c4_director(getAllItemInfo={}):
return c4_director_mock
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(
@ -86,7 +87,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}
@ -109,7 +110,7 @@ async def test_form_invalid_auth(hass):
assert result2["errors"] == {"base": "invalid_auth"}
async def test_form_unexpected_exception(hass):
async def test_form_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}
@ -132,7 +133,7 @@ async def test_form_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}
@ -158,7 +159,7 @@ async def test_form_cannot_connect(hass):
assert result2["errors"] == {"base": "cannot_connect"}
async def test_option_flow(hass):
async def test_option_flow(hass: HomeAssistant) -> None:
"""Test config flow options."""
entry = MockConfigEntry(domain=DOMAIN, data={}, options=None)
entry.add_to_hass(hass)
@ -178,7 +179,7 @@ async def test_option_flow(hass):
}
async def test_option_flow_defaults(hass):
async def test_option_flow_defaults(hass: HomeAssistant) -> None:
"""Test config flow options."""
entry = MockConfigEntry(domain=DOMAIN, data={}, options=None)
entry.add_to_hass(hass)