mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 05:37:44 +00:00
Use reference strings in Smarthab (#41391)
This commit is contained in:
parent
4968a12b6c
commit
7c133e4630
@ -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)
|
||||
|
||||
|
@ -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 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user