mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 01:38:02 +00:00
Use of reference strings in Transmission config flow (#41215)
This commit is contained in:
parent
14273e9e48
commit
ed9a40874d
@ -64,13 +64,12 @@ class TransmissionFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
if entry.data[CONF_NAME] == user_input[CONF_NAME]:
|
||||
errors[CONF_NAME] = "name_exists"
|
||||
break
|
||||
|
||||
try:
|
||||
await get_api(self.hass, user_input)
|
||||
|
||||
except AuthenticationError:
|
||||
errors[CONF_USERNAME] = "wrong_credentials"
|
||||
errors[CONF_PASSWORD] = "wrong_credentials"
|
||||
errors[CONF_USERNAME] = "invalid_auth"
|
||||
errors[CONF_PASSWORD] = "invalid_auth"
|
||||
except (CannotConnect, UnknownError):
|
||||
errors["base"] = "cannot_connect"
|
||||
|
||||
|
@ -13,12 +13,12 @@
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"name_exists": "Name already exists",
|
||||
"wrong_credentials": "Wrong username or password",
|
||||
"cannot_connect": "Unable to Connect to host"
|
||||
"name_exists": "[%key:common::config_flow::data::name%] already exists",
|
||||
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
||||
},
|
||||
"abort": {
|
||||
"already_configured": "Host is already configured."
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
|
@ -264,8 +264,8 @@ async def test_error_on_wrong_credentials(hass, auth_error):
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["errors"] == {
|
||||
CONF_USERNAME: "wrong_credentials",
|
||||
CONF_PASSWORD: "wrong_credentials",
|
||||
CONF_USERNAME: "invalid_auth",
|
||||
CONF_PASSWORD: "invalid_auth",
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user