mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Modernize reauth flow in ruckus_unleashed (#168013)
This commit is contained in:
@@ -86,12 +86,10 @@ class RuckusConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
return self.async_create_entry(
|
||||
title=info[KEY_SYS_TITLE], data=user_input
|
||||
)
|
||||
reauth_entry = self._get_reauth_entry()
|
||||
if info[KEY_SYS_SERIAL] == reauth_entry.unique_id:
|
||||
return self.async_update_reload_and_abort(
|
||||
reauth_entry, data=user_input
|
||||
)
|
||||
errors["base"] = "invalid_host"
|
||||
self._abort_if_unique_id_mismatch(reason="invalid_host")
|
||||
return self.async_update_reload_and_abort(
|
||||
self._get_reauth_entry(), data=user_input
|
||||
)
|
||||
|
||||
data_schema = DATA_SCHEMA
|
||||
if self.source == SOURCE_REAUTH:
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
|
||||
"invalid_host": "[%key:common::config_flow::error::invalid_host%]",
|
||||
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
|
||||
"invalid_host": "[%key:common::config_flow::error::invalid_host%]",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
},
|
||||
"step": {
|
||||
|
||||
@@ -136,8 +136,8 @@ async def test_form_user_reauth_different_unique_id(hass: HomeAssistant) -> None
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] is FlowResultType.FORM
|
||||
assert result2["errors"] == {"base": "invalid_host"}
|
||||
assert result2["type"] is FlowResultType.ABORT
|
||||
assert result2["reason"] == "invalid_host"
|
||||
|
||||
|
||||
async def test_form_user_reauth_invalid_auth(hass: HomeAssistant) -> None:
|
||||
|
||||
Reference in New Issue
Block a user