mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Use of reference strings for Airly config flow (#40946)
This commit is contained in:
parent
a3b62cea6a
commit
3195ce5d56
@ -39,7 +39,7 @@ class AirlyFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
self._abort_if_unique_id_configured()
|
self._abort_if_unique_id_configured()
|
||||||
api_key_valid = await self._test_api_key(websession, user_input["api_key"])
|
api_key_valid = await self._test_api_key(websession, user_input["api_key"])
|
||||||
if not api_key_valid:
|
if not api_key_valid:
|
||||||
self._errors["base"] = "auth"
|
self._errors["base"] = "invalid_api_key"
|
||||||
else:
|
else:
|
||||||
location_valid = await self._test_location(
|
location_valid = await self._test_location(
|
||||||
websession,
|
websession,
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"wrong_location": "No Airly measuring stations in this area.",
|
"wrong_location": "No Airly measuring stations in this area.",
|
||||||
"auth": "API key is not correct."
|
"invalid_api_key": "[%key:common::config_flow::error::invalid_api_key%]"
|
||||||
},
|
},
|
||||||
"abort": {
|
"abort": {
|
||||||
"already_configured": "Airly integration for these coordinates is already configured."
|
"already_configured": "Airly integration for these coordinates is already configured."
|
||||||
|
@ -48,7 +48,7 @@ async def test_invalid_api_key(hass):
|
|||||||
DOMAIN, context={"source": SOURCE_USER}, data=CONFIG
|
DOMAIN, context={"source": SOURCE_USER}, data=CONFIG
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result["errors"] == {"base": "auth"}
|
assert result["errors"] == {"base": "invalid_api_key"}
|
||||||
|
|
||||||
|
|
||||||
async def test_invalid_location(hass):
|
async def test_invalid_location(hass):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user