mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Use start_reauth_flow in permobil tests (#129314)
This commit is contained in:
parent
2bec20ad76
commit
0216d36ab7
@ -284,11 +284,7 @@ async def test_config_flow_reauth_success(
|
||||
"homeassistant.components.permobil.config_flow.MyPermobil",
|
||||
return_value=my_permobil,
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
config_flow.DOMAIN,
|
||||
context={"source": "reauth", "entry_id": mock_entry.entry_id},
|
||||
data=mock_entry.data,
|
||||
)
|
||||
result = await mock_entry.start_reauth_flow(hass)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "email_code"
|
||||
@ -328,11 +324,7 @@ async def test_config_flow_reauth_fail_invalid_code(
|
||||
"homeassistant.components.permobil.config_flow.MyPermobil",
|
||||
return_value=my_permobil,
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
config_flow.DOMAIN,
|
||||
context={"source": "reauth", "entry_id": mock_entry.entry_id},
|
||||
data=mock_entry.data,
|
||||
)
|
||||
result = await mock_entry.start_reauth_flow(hass)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "email_code"
|
||||
@ -360,17 +352,11 @@ async def test_config_flow_reauth_fail_code_request(
|
||||
)
|
||||
mock_entry.add_to_hass(hass)
|
||||
# test the reauth and have request_application_code fail leading to an abort
|
||||
my_permobil.request_application_code.side_effect = MyPermobilAPIException
|
||||
reauth_entry = hass.config_entries.async_entries(config_flow.DOMAIN)[0]
|
||||
with patch(
|
||||
"homeassistant.components.permobil.config_flow.MyPermobil",
|
||||
return_value=my_permobil,
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
config_flow.DOMAIN,
|
||||
context={"source": "reauth", "entry_id": reauth_entry.entry_id},
|
||||
data=mock_entry.data,
|
||||
)
|
||||
result = await mock_entry.start_reauth_flow(hass)
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "unknown"
|
||||
|
Loading…
x
Reference in New Issue
Block a user