mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +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]:
|
if entry.data[CONF_NAME] == user_input[CONF_NAME]:
|
||||||
errors[CONF_NAME] = "name_exists"
|
errors[CONF_NAME] = "name_exists"
|
||||||
break
|
break
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await get_api(self.hass, user_input)
|
await get_api(self.hass, user_input)
|
||||||
|
|
||||||
except AuthenticationError:
|
except AuthenticationError:
|
||||||
errors[CONF_USERNAME] = "wrong_credentials"
|
errors[CONF_USERNAME] = "invalid_auth"
|
||||||
errors[CONF_PASSWORD] = "wrong_credentials"
|
errors[CONF_PASSWORD] = "invalid_auth"
|
||||||
except (CannotConnect, UnknownError):
|
except (CannotConnect, UnknownError):
|
||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
|
|
||||||
|
@ -13,12 +13,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"name_exists": "Name already exists",
|
"name_exists": "[%key:common::config_flow::data::name%] already exists",
|
||||||
"wrong_credentials": "Wrong username or password",
|
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
|
||||||
"cannot_connect": "Unable to Connect to host"
|
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
||||||
},
|
},
|
||||||
"abort": {
|
"abort": {
|
||||||
"already_configured": "Host is already configured."
|
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options": {
|
"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["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||||
assert result["errors"] == {
|
assert result["errors"] == {
|
||||||
CONF_USERNAME: "wrong_credentials",
|
CONF_USERNAME: "invalid_auth",
|
||||||
CONF_PASSWORD: "wrong_credentials",
|
CONF_PASSWORD: "invalid_auth",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user