Fix ConfigFlowResult annotations in tests (#122215)

pull/122232/head
Marc Mueller 2024-07-20 11:13:13 +02:00 committed by GitHub
parent e9f5c4188e
commit 0637e342f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 12 deletions

View File

@ -47,7 +47,9 @@ def bypass_setup_fixture():
@pytest.fixture(name="user_step_result")
async def user_step_result_fixture(hass: HomeAssistant) -> FlowResultType:
async def user_step_result_fixture(
hass: HomeAssistant,
) -> config_entries.ConfigFlowResult:
"""Provide the result of a completed user step."""
init_result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
@ -65,7 +67,9 @@ async def user_step_result_fixture(hass: HomeAssistant) -> FlowResultType:
@pytest.fixture(name="option_init_result")
async def option_init_result_fixture(hass: HomeAssistant) -> FlowResultType:
async def option_init_result_fixture(
hass: HomeAssistant,
) -> config_entries.ConfigFlowResult:
"""Provide the result of a completed options init step."""
entry = MockConfigEntry(
domain=DOMAIN,
@ -94,8 +98,8 @@ async def option_init_result_fixture(hass: HomeAssistant) -> FlowResultType:
@pytest.fixture(name="origin_step_result")
async def origin_step_result_fixture(
hass: HomeAssistant, user_step_result: FlowResultType
) -> FlowResultType:
hass: HomeAssistant, user_step_result: config_entries.ConfigFlowResult
) -> config_entries.ConfigFlowResult:
"""Provide the result of a completed origin by coordinates step."""
origin_menu_result = await hass.config_entries.flow.async_configure(
user_step_result["flow_id"], {"next_step_id": "origin_coordinates"}
@ -142,7 +146,7 @@ async def test_step_user(hass: HomeAssistant, menu_options) -> None:
@pytest.mark.usefixtures("valid_response")
async def test_step_origin_coordinates(
hass: HomeAssistant, user_step_result: FlowResultType
hass: HomeAssistant, user_step_result: config_entries.ConfigFlowResult
) -> None:
"""Test the origin coordinates step."""
menu_result = await hass.config_entries.flow.async_configure(
@ -165,7 +169,7 @@ async def test_step_origin_coordinates(
@pytest.mark.usefixtures("valid_response")
async def test_step_origin_entity(
hass: HomeAssistant, user_step_result: FlowResultType
hass: HomeAssistant, user_step_result: config_entries.ConfigFlowResult
) -> None:
"""Test the origin coordinates step."""
menu_result = await hass.config_entries.flow.async_configure(
@ -182,7 +186,7 @@ async def test_step_origin_entity(
@pytest.mark.usefixtures("valid_response")
async def test_step_destination_coordinates(
hass: HomeAssistant, origin_step_result: FlowResultType
hass: HomeAssistant, origin_step_result: config_entries.ConfigFlowResult
) -> None:
"""Test the origin coordinates step."""
menu_result = await hass.config_entries.flow.async_configure(
@ -216,7 +220,7 @@ async def test_step_destination_coordinates(
@pytest.mark.usefixtures("valid_response")
async def test_step_destination_entity(
hass: HomeAssistant,
origin_step_result: FlowResultType,
origin_step_result: config_entries.ConfigFlowResult,
) -> None:
"""Test the origin coordinates step."""
menu_result = await hass.config_entries.flow.async_configure(
@ -322,7 +326,7 @@ async def test_options_flow(hass: HomeAssistant) -> None:
@pytest.mark.usefixtures("valid_response")
async def test_options_flow_arrival_time_step(
hass: HomeAssistant, option_init_result: FlowResultType
hass: HomeAssistant, option_init_result: config_entries.ConfigFlowResult
) -> None:
"""Test the options flow arrival time type."""
menu_result = await hass.config_entries.options.async_configure(
@ -346,7 +350,7 @@ async def test_options_flow_arrival_time_step(
@pytest.mark.usefixtures("valid_response")
async def test_options_flow_departure_time_step(
hass: HomeAssistant, option_init_result: FlowResultType
hass: HomeAssistant, option_init_result: config_entries.ConfigFlowResult
) -> None:
"""Test the options flow departure time type."""
menu_result = await hass.config_entries.options.async_configure(
@ -370,7 +374,7 @@ async def test_options_flow_departure_time_step(
@pytest.mark.usefixtures("valid_response")
async def test_options_flow_no_time_step(
hass: HomeAssistant, option_init_result: FlowResultType
hass: HomeAssistant, option_init_result: config_entries.ConfigFlowResult
) -> None:
"""Test the options flow arrival time type."""
menu_result = await hass.config_entries.options.async_configure(

View File

@ -38,7 +38,7 @@ pytestmark = pytest.mark.usefixtures("mock_setup_entry")
async def _get_connection_form(
hass: HomeAssistant, connection_type: str
) -> FlowResultType:
) -> config_entries.ConfigFlowResult:
"""Test we get the form."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}