From 7c133e4630066295832bc0fc7181019fdc898674 Mon Sep 17 00:00:00 2001 From: SNoof85 Date: Wed, 7 Oct 2020 14:39:30 +0200 Subject: [PATCH] Use reference strings in Smarthab (#41391) --- homeassistant/components/smarthab/config_flow.py | 4 ++-- homeassistant/components/smarthab/strings.json | 6 +++--- tests/components/smarthab/test_config_flow.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/smarthab/config_flow.py b/homeassistant/components/smarthab/config_flow.py index a277388c140..68f0460a4cc 100644 --- a/homeassistant/components/smarthab/config_flow.py +++ b/homeassistant/components/smarthab/config_flow.py @@ -65,13 +65,13 @@ class SmartHabConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): title=username, data={CONF_EMAIL: username, CONF_PASSWORD: password} ) - errors["base"] = "wrong_login" + errors["base"] = "invalid_auth" except pysmarthab.RequestFailedException: _LOGGER.exception("Error while trying to reach SmartHab API") errors["base"] = "service" except Exception: # pylint: disable=broad-except _LOGGER.exception("Unexpected error during login") - errors["base"] = "unknown_error" + errors["base"] = "unknown" return self._show_setup_form(user_input, errors) diff --git a/homeassistant/components/smarthab/strings.json b/homeassistant/components/smarthab/strings.json index f27e359257f..e1cb6eb4411 100644 --- a/homeassistant/components/smarthab/strings.json +++ b/homeassistant/components/smarthab/strings.json @@ -2,8 +2,8 @@ "config": { "error": { "service": "Error while trying to reach SmartHab. Service might be down. Check your connection.", - "wrong_login": "[%key:common::config_flow::error::invalid_auth%]", - "unknown_error": "[%key:common::config_flow::error::unknown%]" + "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", + "unknown": "[%key:common::config_flow::error::unknown%]" }, "step": { "user": { @@ -16,4 +16,4 @@ } } } -} \ No newline at end of file +} diff --git a/tests/components/smarthab/test_config_flow.py b/tests/components/smarthab/test_config_flow.py index 6303fd44def..d15fe58999e 100644 --- a/tests/components/smarthab/test_config_flow.py +++ b/tests/components/smarthab/test_config_flow.py @@ -55,7 +55,7 @@ async def test_form_invalid_auth(hass): ) assert result2["type"] == "form" - assert result2["errors"] == {"base": "wrong_login"} + assert result2["errors"] == {"base": "invalid_auth"} async def test_form_service_error(hass): @@ -93,7 +93,7 @@ async def test_form_unknown_error(hass): ) assert result2["type"] == "form" - assert result2["errors"] == {"base": "unknown_error"} + assert result2["errors"] == {"base": "unknown"} async def test_import(hass):