From d3a0743fea55b2be3f7d73e0f576185ae3f5d8af Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Fri, 2 Oct 2020 21:59:55 +0200 Subject: [PATCH] Use reference strings in Abode (#41004) * Use translation references * Suggested change * Remove unused string * Rename invalid_credentials key * Fix invalid_auth in manifest.json file --- homeassistant/components/abode/config_flow.py | 4 ++-- homeassistant/components/abode/strings.json | 7 +++---- tests/components/abode/test_config_flow.py | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/abode/config_flow.py b/homeassistant/components/abode/config_flow.py index 18146551a56..72e7ec1d9eb 100644 --- a/homeassistant/components/abode/config_flow.py +++ b/homeassistant/components/abode/config_flow.py @@ -47,8 +47,8 @@ class AbodeFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): except (AbodeException, ConnectTimeout, HTTPError) as ex: LOGGER.error("Unable to connect to Abode: %s", str(ex)) if ex.errcode == HTTP_BAD_REQUEST: - return self._show_form({"base": "invalid_credentials"}) - return self._show_form({"base": "connection_error"}) + return self._show_form({"base": "invalid_auth"}) + return self._show_form({"base": "cannot_connect"}) return self.async_create_entry( title=user_input[CONF_USERNAME], diff --git a/homeassistant/components/abode/strings.json b/homeassistant/components/abode/strings.json index 14d570e76e2..63b62fefcec 100644 --- a/homeassistant/components/abode/strings.json +++ b/homeassistant/components/abode/strings.json @@ -10,12 +10,11 @@ } }, "error": { - "identifier_exists": "Account already registered.", - "invalid_credentials": "Invalid credentials.", - "connection_error": "Unable to connect to Abode." + "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", + "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]" }, "abort": { - "single_instance_allowed": "Only a single configuration of Abode is allowed." + "single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]" } } } \ No newline at end of file diff --git a/tests/components/abode/test_config_flow.py b/tests/components/abode/test_config_flow.py index 01508d412a2..509a68eda4b 100644 --- a/tests/components/abode/test_config_flow.py +++ b/tests/components/abode/test_config_flow.py @@ -61,7 +61,7 @@ async def test_invalid_credentials(hass): side_effect=AbodeAuthenticationException((400, "auth error")), ): result = await flow.async_step_user(user_input=conf) - assert result["errors"] == {"base": "invalid_credentials"} + assert result["errors"] == {"base": "invalid_auth"} async def test_connection_error(hass): @@ -78,7 +78,7 @@ async def test_connection_error(hass): ), ): result = await flow.async_step_user(user_input=conf) - assert result["errors"] == {"base": "connection_error"} + assert result["errors"] == {"base": "cannot_connect"} async def test_step_import(hass):