Fix missing translations in tradfri (#130654)

* Fix missing translations in tradfri

* Simplify
pull/130669/head^2
epenet 2024-11-15 04:42:15 +01:00 committed by GitHub
parent aea8e8abac
commit e8b0b3e05c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 10 deletions

View File

@ -60,10 +60,7 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
return await self._entry_from_data(auth)
except AuthError as err:
if err.code == "invalid_security_code":
errors[KEY_SECURITY_CODE] = err.code
else:
errors["base"] = err.code
errors["base"] = err.code
else:
user_input = {}

View File

@ -14,7 +14,7 @@
}
},
"error": {
"invalid_key": "Failed to register with provided key. If this keeps happening, try restarting the gateway.",
"invalid_security_code": "Failed to register with provided key. If this keeps happening, try restarting the gateway.",
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"timeout": "Timeout validating the code.",
"cannot_authenticate": "Cannot authenticate, is Gateway paired with another server like e.g. Homekit?"

View File

@ -86,10 +86,6 @@ async def test_user_connection_timeout(
assert result["errors"] == {"base": "timeout"}
@pytest.mark.parametrize( # Remove when translations fixed
"ignore_translations",
["component.tradfri.config.error.invalid_security_code"],
)
async def test_user_connection_bad_key(
hass: HomeAssistant, mock_auth, mock_entry_setup
) -> None:
@ -107,7 +103,7 @@ async def test_user_connection_bad_key(
assert len(mock_entry_setup.mock_calls) == 0
assert result["type"] is FlowResultType.FORM
assert result["errors"] == {"security_code": "invalid_security_code"}
assert result["errors"] == {"base": "invalid_security_code"}
async def test_discovery_connection(