Use of reference strings for Airly config flow (#40946)

This commit is contained in:
SNoof85 2020-10-01 12:28:32 +02:00 committed by GitHub
parent a3b62cea6a
commit 3195ce5d56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -39,7 +39,7 @@ class AirlyFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
self._abort_if_unique_id_configured()
api_key_valid = await self._test_api_key(websession, user_input["api_key"])
if not api_key_valid:
self._errors["base"] = "auth"
self._errors["base"] = "invalid_api_key"
else:
location_valid = await self._test_location(
websession,

View File

@ -14,10 +14,10 @@
},
"error": {
"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": {
"already_configured": "Airly integration for these coordinates is already configured."
}
}
}
}

View File

@ -48,7 +48,7 @@ async def test_invalid_api_key(hass):
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):