Switch unifiprotect to use async_update_reload_and_abort helper (#108934)
parent
5177d022e8
commit
0120d00081
|
@ -295,9 +295,7 @@ class ProtectFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
# validate login data
|
# validate login data
|
||||||
_, errors = await self._async_get_nvr_data(form_data)
|
_, errors = await self._async_get_nvr_data(form_data)
|
||||||
if not errors:
|
if not errors:
|
||||||
self.hass.config_entries.async_update_entry(self.entry, data=form_data)
|
return self.async_update_reload_and_abort(self.entry, data=form_data)
|
||||||
await self.hass.config_entries.async_reload(self.entry.entry_id)
|
|
||||||
return self.async_abort(reason="reauth_successful")
|
|
||||||
|
|
||||||
self.context["title_placeholders"] = {
|
self.context["title_placeholders"] = {
|
||||||
"name": self.entry.title,
|
"name": self.entry.title,
|
||||||
|
|
|
@ -226,9 +226,10 @@ async def test_form_reauth_auth(hass: HomeAssistant, nvr: NVR) -> None:
|
||||||
result2["flow_id"],
|
result2["flow_id"],
|
||||||
{
|
{
|
||||||
"username": "test-username",
|
"username": "test-username",
|
||||||
"password": "test-password",
|
"password": "new-password",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert result3["type"] == FlowResultType.ABORT
|
assert result3["type"] == FlowResultType.ABORT
|
||||||
assert result3["reason"] == "reauth_successful"
|
assert result3["reason"] == "reauth_successful"
|
||||||
|
|
Loading…
Reference in New Issue