mirror of
https://github.com/home-assistant/core
synced 2024-10-07 22:11:59 +00:00
Use common strings in Atag config flow (#41351)
This commit is contained in:
parent
734972f876
commit
a71049112e
|
@ -36,7 +36,7 @@ class AtagConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
except pyatag.errors.Unauthorized:
|
except pyatag.errors.Unauthorized:
|
||||||
return await self._show_form({"base": "unauthorized"})
|
return await self._show_form({"base": "unauthorized"})
|
||||||
except pyatag.errors.AtagException:
|
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)
|
await self.async_set_unique_id(atag.id)
|
||||||
self._abort_if_unique_id_configured(updates=user_input)
|
self._abort_if_unique_id_configured(updates=user_input)
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"unauthorized": "Pairing denied, check device for auth request",
|
"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": {
|
"abort": {
|
||||||
"already_configured": "This device has already been added to HomeAssistant"
|
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ async def test_connection_error(hass):
|
||||||
|
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||||
assert result["step_id"] == "user"
|
assert result["step_id"] == "user"
|
||||||
assert result["errors"] == {"base": "connection_error"}
|
assert result["errors"] == {"base": "cannot_connect"}
|
||||||
|
|
||||||
|
|
||||||
async def test_unauthorized(hass):
|
async def test_unauthorized(hass):
|
||||||
|
|
Loading…
Reference in a new issue