Use reference strings in Coolmaster (#41066)

* Update strings.json

* Update config_flow.py

* Update test_config_flow.py
This commit is contained in:
SNoof85 2020-10-02 21:17:32 +02:00 committed by GitHub
parent 135be787e2
commit 65611320d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -54,7 +54,7 @@ class CoolmasterConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
if not result: if not result:
errors["base"] = "no_units" errors["base"] = "no_units"
except (OSError, ConnectionRefusedError, TimeoutError): except (OSError, ConnectionRefusedError, TimeoutError):
errors["base"] = "connection_error" errors["base"] = "cannot_connect"
if errors: if errors:
return self.async_show_form( return self.async_show_form(

View File

@ -15,7 +15,7 @@
} }
}, },
"error": { "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_units": "Could not find any HVAC units in CoolMasterNet host."
} }
} }

View File

@ -60,7 +60,7 @@ async def test_form_timeout(hass):
) )
assert result2["type"] == "form" assert result2["type"] == "form"
assert result2["errors"] == {"base": "connection_error"} assert result2["errors"] == {"base": "cannot_connect"}
async def test_form_connection_refused(hass): async def test_form_connection_refused(hass):
@ -78,7 +78,7 @@ async def test_form_connection_refused(hass):
) )
assert result2["type"] == "form" assert result2["type"] == "form"
assert result2["errors"] == {"base": "connection_error"} assert result2["errors"] == {"base": "cannot_connect"}
async def test_form_no_units(hass): async def test_form_no_units(hass):