Split user flow init and data submission in AccuWeather tests (#179628)

This commit is contained in:
Maciej Bieniek
2026-08-20 14:09:27 +02:00
committed by GitHub
parent cb24f2f784
commit c2ba23ee3c
@@ -41,9 +41,14 @@ async def test_invalid_api_key(
)
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_USER},
data=VALID_CONFIG,
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
result = await hass.config_entries.flow.async_configure(
result["flow_id"], user_input=VALID_CONFIG
)
assert result["errors"] == {CONF_API_KEY: "invalid_api_key"}
@@ -58,9 +63,14 @@ async def test_api_error(
)
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_USER},
data=VALID_CONFIG,
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
result = await hass.config_entries.flow.async_configure(
result["flow_id"], user_input=VALID_CONFIG
)
assert result["errors"] == {"base": "cannot_connect"}
@@ -75,9 +85,14 @@ async def test_requests_exceeded_error(
)
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_USER},
data=VALID_CONFIG,
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
result = await hass.config_entries.flow.async_configure(
result["flow_id"], user_input=VALID_CONFIG
)
assert result["errors"] == {CONF_API_KEY: "requests_exceeded"}
@@ -94,9 +109,14 @@ async def test_integration_already_exists(
).add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_USER},
data=VALID_CONFIG,
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
result = await hass.config_entries.flow.async_configure(
result["flow_id"], user_input=VALID_CONFIG
)
assert result["type"] is FlowResultType.ABORT
@@ -108,9 +128,14 @@ async def test_create_entry(
) -> None:
"""Test that the user step works."""
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_USER},
data=VALID_CONFIG,
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "user"
result = await hass.config_entries.flow.async_configure(
result["flow_id"], user_input=VALID_CONFIG
)
assert result["type"] is FlowResultType.CREATE_ENTRY