Fix the name of the translation key for Brother integration (#41054)

This commit is contained in:
Maciej Bieniek 2020-10-02 15:06:28 +02:00 committed by GitHub
parent ab17b4ab70
commit bba0bb1bad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -59,7 +59,7 @@ class BrotherConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
except InvalidHost: except InvalidHost:
errors[CONF_HOST] = "wrong_host" errors[CONF_HOST] = "wrong_host"
except ConnectionError: except ConnectionError:
errors["base"] = "connection_error" errors["base"] = "cannot_connect"
except SnmpError: except SnmpError:
errors["base"] = "snmp_error" errors["base"] = "snmp_error"
except UnsupportedModel: except UnsupportedModel:
@ -72,7 +72,7 @@ class BrotherConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_zeroconf(self, discovery_info): async def async_step_zeroconf(self, discovery_info):
"""Handle zeroconf discovery.""" """Handle zeroconf discovery."""
if discovery_info is None: if discovery_info is None:
return self.async_abort(reason="connection_error") return self.async_abort(reason="cannot_connect")
if not discovery_info.get("name") or not discovery_info["name"].startswith( if not discovery_info.get("name") or not discovery_info["name"].startswith(
"Brother" "Brother"
@ -86,7 +86,7 @@ class BrotherConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
try: try:
await self.brother.async_update() await self.brother.async_update()
except (ConnectionError, SnmpError, UnsupportedModel): except (ConnectionError, SnmpError, UnsupportedModel):
return self.async_abort(reason="connection_error") return self.async_abort(reason="cannot_connect")
# Check if already configured # Check if already configured
await self.async_set_unique_id(self.brother.serial.lower()) await self.async_set_unique_id(self.brother.serial.lower())

View File

@ -19,7 +19,7 @@
}, },
"error": { "error": {
"wrong_host": "Invalid hostname or IP address.", "wrong_host": "Invalid hostname or IP address.",
"connection_error": "[%key:common::config_flow::error::cannot_connect%]", "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"snmp_error": "SNMP server turned off or printer not supported." "snmp_error": "SNMP server turned off or printer not supported."
}, },
"abort": { "abort": {

View File

@ -76,7 +76,7 @@ async def test_connection_error(hass):
DOMAIN, context={"source": SOURCE_USER}, data=CONFIG DOMAIN, context={"source": SOURCE_USER}, data=CONFIG
) )
assert result["errors"] == {"base": "connection_error"} assert result["errors"] == {"base": "cannot_connect"}
async def test_snmp_error(hass): async def test_snmp_error(hass):
@ -125,7 +125,7 @@ async def test_zeroconf_no_data(hass):
) )
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"] == "connection_error" assert result["reason"] == "cannot_connect"
async def test_zeroconf_not_brother_printer_error(hass): async def test_zeroconf_not_brother_printer_error(hass):
@ -156,7 +156,7 @@ async def test_zeroconf_snmp_error(hass):
) )
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"] == "connection_error" assert result["reason"] == "cannot_connect"
async def test_zeroconf_device_exists_abort(hass): async def test_zeroconf_device_exists_abort(hass):