Skip to content

Commit ed9a408

Browse files
authored
Use of reference strings in Transmission config flow (home-assistant#41215)
1 parent 14273e9 commit ed9a408

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

homeassistant/components/transmission/config_flow.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,12 @@ async def async_step_user(self, user_input=None):
6464
if entry.data[CONF_NAME] == user_input[CONF_NAME]:
6565
errors[CONF_NAME] = "name_exists"
6666
break
67-
6867
try:
6968
await get_api(self.hass, user_input)
7069

7170
except AuthenticationError:
72-
errors[CONF_USERNAME] = "wrong_credentials"
73-
errors[CONF_PASSWORD] = "wrong_credentials"
71+
errors[CONF_USERNAME] = "invalid_auth"
72+
errors[CONF_PASSWORD] = "invalid_auth"
7473
except (CannotConnect, UnknownError):
7574
errors["base"] = "cannot_connect"
7675

homeassistant/components/transmission/strings.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
}
1414
},
1515
"error": {
16-
"name_exists": "Name already exists",
17-
"wrong_credentials": "Wrong username or password",
18-
"cannot_connect": "Unable to Connect to host"
16+
"name_exists": "[%key:common::config_flow::data::name%] already exists",
17+
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
18+
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
1919
},
2020
"abort": {
21-
"already_configured": "Host is already configured."
21+
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
2222
}
2323
},
2424
"options": {

tests/components/transmission/test_config_flow.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ async def test_error_on_wrong_credentials(hass, auth_error):
264264
)
265265
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
266266
assert result["errors"] == {
267-
CONF_USERNAME: "wrong_credentials",
268-
CONF_PASSWORD: "wrong_credentials",
267+
CONF_USERNAME: "invalid_auth",
268+
CONF_PASSWORD: "invalid_auth",
269269
}
270270

271271

0 commit comments

Comments
 (0)