Use common strings in Atag config flow (#41351)

This commit is contained in:
scheric 2020-10-08 15:27:28 +02:00 committed by GitHub
parent 734972f876
commit a71049112e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -36,7 +36,7 @@ class AtagConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
except pyatag.errors.Unauthorized:
return await self._show_form({"base": "unauthorized"})
except pyatag.errors.AtagException:
return await self._show_form({"base": "connection_error"})
return await self._show_form({"base": "cannot_connect"})
await self.async_set_unique_id(atag.id)
self._abort_if_unique_id_configured(updates=user_input)

View file

@ -13,10 +13,10 @@
},
"error": {
"unauthorized": "Pairing denied, check device for auth request",
"connection_error": "[%key:common::config_flow::error::cannot_connect%]"
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
},
"abort": {
"already_configured": "This device has already been added to HomeAssistant"
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
}
}
}

View file

@ -58,7 +58,7 @@ async def test_connection_error(hass):
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "user"
assert result["errors"] == {"base": "connection_error"}
assert result["errors"] == {"base": "cannot_connect"}
async def test_unauthorized(hass):