From 65611320d49924c394f15478da35593cb2361b27 Mon Sep 17 00:00:00 2001 From: SNoof85 Date: Fri, 2 Oct 2020 21:17:32 +0200 Subject: [PATCH] Use reference strings in Coolmaster (#41066) * Update strings.json * Update config_flow.py * Update test_config_flow.py --- homeassistant/components/coolmaster/config_flow.py | 2 +- homeassistant/components/coolmaster/strings.json | 4 ++-- tests/components/coolmaster/test_config_flow.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/coolmaster/config_flow.py b/homeassistant/components/coolmaster/config_flow.py index c674146fd15..7c9b4d5d065 100644 --- a/homeassistant/components/coolmaster/config_flow.py +++ b/homeassistant/components/coolmaster/config_flow.py @@ -54,7 +54,7 @@ class CoolmasterConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): if not result: errors["base"] = "no_units" except (OSError, ConnectionRefusedError, TimeoutError): - errors["base"] = "connection_error" + errors["base"] = "cannot_connect" if errors: return self.async_show_form( diff --git a/homeassistant/components/coolmaster/strings.json b/homeassistant/components/coolmaster/strings.json index fd91e5576d2..7afc012a191 100644 --- a/homeassistant/components/coolmaster/strings.json +++ b/homeassistant/components/coolmaster/strings.json @@ -15,8 +15,8 @@ } }, "error": { - "connection_error": "Failed to connect to CoolMasterNet instance. Please check your host.", + "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", "no_units": "Could not find any HVAC units in CoolMasterNet host." } } -} \ No newline at end of file +} diff --git a/tests/components/coolmaster/test_config_flow.py b/tests/components/coolmaster/test_config_flow.py index fc296a53ddf..b758a37db1d 100644 --- a/tests/components/coolmaster/test_config_flow.py +++ b/tests/components/coolmaster/test_config_flow.py @@ -60,7 +60,7 @@ async def test_form_timeout(hass): ) assert result2["type"] == "form" - assert result2["errors"] == {"base": "connection_error"} + assert result2["errors"] == {"base": "cannot_connect"} async def test_form_connection_refused(hass): @@ -78,7 +78,7 @@ async def test_form_connection_refused(hass): ) assert result2["type"] == "form" - assert result2["errors"] == {"base": "connection_error"} + assert result2["errors"] == {"base": "cannot_connect"} async def test_form_no_units(hass):