mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Add PIN recovery test to Subaru config flow (#178679)
This commit is contained in:
@@ -349,7 +349,7 @@ async def test_pin_form_success(hass: HomeAssistant, pin_form) -> None:
|
||||
|
||||
|
||||
async def test_pin_form_incorrect_pin(hass: HomeAssistant, pin_form) -> None:
|
||||
"""Test we handle invalid pin."""
|
||||
"""Test we handle invalid pin, and that the flow can still be completed afterward."""
|
||||
with (
|
||||
patch(
|
||||
MOCK_API_TEST_PIN,
|
||||
@@ -368,6 +368,16 @@ async def test_pin_form_incorrect_pin(hass: HomeAssistant, pin_form) -> None:
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "incorrect_pin"}
|
||||
|
||||
with (
|
||||
patch(MOCK_API_TEST_PIN, return_value=True),
|
||||
patch(MOCK_API_UPDATE_SAVED_PIN, return_value=True),
|
||||
patch(ASYNC_SETUP_ENTRY, return_value=True),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_PIN: TEST_PIN}
|
||||
)
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
|
||||
|
||||
async def test_option_flow_form(options_form) -> None:
|
||||
"""Test config flow options form."""
|
||||
|
||||
Reference in New Issue
Block a user