Fix Life360 reauthorization config flow (#99227)
This commit is contained in:
parent
2e0a22fdaf
commit
10c53dd284
2 changed files with 15 additions and 0 deletions
|
@ -137,6 +137,12 @@ class Life360ConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
async def async_step_reauth_confirm(self, user_input: dict[str, Any]) -> FlowResult:
|
async def async_step_reauth_confirm(self, user_input: dict[str, Any]) -> FlowResult:
|
||||||
"""Handle reauthorization completion."""
|
"""Handle reauthorization completion."""
|
||||||
|
if not user_input:
|
||||||
|
return self.async_show_form(
|
||||||
|
step_id="reauth_confirm",
|
||||||
|
data_schema=vol.Schema(password_schema(self._password)),
|
||||||
|
errors={"base": "invalid_auth"},
|
||||||
|
)
|
||||||
self._password = user_input[CONF_PASSWORD]
|
self._password = user_input[CONF_PASSWORD]
|
||||||
return await self._async_verify("reauth_confirm")
|
return await self._async_verify("reauth_confirm")
|
||||||
|
|
||||||
|
|
|
@ -274,6 +274,15 @@ async def test_reauth_config_flow_login_error(
|
||||||
key = list(schema)[0]
|
key = list(schema)[0]
|
||||||
assert key.default() == TEST_PW
|
assert key.default() == TEST_PW
|
||||||
|
|
||||||
|
# Simulate hitting RECONFIGURE button.
|
||||||
|
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||||
|
assert result["step_id"] == "reauth_confirm"
|
||||||
|
assert result["errors"]
|
||||||
|
assert result["errors"]["base"] == "invalid_auth"
|
||||||
|
|
||||||
# Simulate getting a new, valid password.
|
# Simulate getting a new, valid password.
|
||||||
life360_api.get_authorization.reset_mock(side_effect=True)
|
life360_api.get_authorization.reset_mock(side_effect=True)
|
||||||
life360_api.get_authorization.return_value = TEST_AUTHORIZATION_3
|
life360_api.get_authorization.return_value = TEST_AUTHORIZATION_3
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue