mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
Add unknown_authorize_url_generation to base strings for config flows (#42484)
This commit is contained in:
parent
3dd14e05e3
commit
5a892e8fca
@ -177,7 +177,7 @@ class NestFlowHandler(
|
||||
return self.async_abort(reason="authorize_url_timeout")
|
||||
except Exception: # pylint: disable=broad-except
|
||||
_LOGGER.exception("Unexpected error generating auth url")
|
||||
return self.async_abort(reason="authorize_url_fail")
|
||||
return self.async_abort(reason="unknown_authorize_url_generation")
|
||||
|
||||
return self.async_show_form(
|
||||
step_id="link",
|
||||
|
@ -25,7 +25,7 @@
|
||||
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]",
|
||||
"missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]",
|
||||
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
|
||||
"authorize_url_fail": "Unknown error generating an authorize url.",
|
||||
"unknown_authorize_url_generation": "[%key:common::config_flow::abort::unknown_authorize_url_generation%]",
|
||||
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]"
|
||||
},
|
||||
"create_entry": {
|
||||
|
@ -101,7 +101,7 @@ class PointFlowHandler(config_entries.ConfigFlow):
|
||||
return self.async_abort(reason="authorize_url_timeout")
|
||||
except Exception: # pylint: disable=broad-except
|
||||
_LOGGER.exception("Unexpected error generating auth url")
|
||||
return self.async_abort(reason="authorize_url_fail")
|
||||
return self.async_abort(reason="unknown_authorize_url_generation")
|
||||
return self.async_show_form(
|
||||
step_id="auth",
|
||||
description_placeholders={"authorization_url": url},
|
||||
|
@ -23,7 +23,7 @@
|
||||
"external_setup": "Point successfully configured from another flow.",
|
||||
"no_flows": "[%key:common::config_flow::abort::oauth2_missing_configuration%]",
|
||||
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
|
||||
"authorize_url_fail": "Unknown error generating an authorize url."
|
||||
"unknown_authorize_url_generation": "[%key:common::config_flow::abort::unknown_authorize_url_generation%]"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,12 +97,12 @@ class FlowHandler(config_entries.ConfigFlow):
|
||||
with async_timeout.timeout(10):
|
||||
auth_url = await self.hass.async_add_executor_job(self._get_auth_url)
|
||||
if not auth_url:
|
||||
return self.async_abort(reason="authorize_url_fail")
|
||||
return self.async_abort(reason="unknown_authorize_url_generation")
|
||||
except asyncio.TimeoutError:
|
||||
return self.async_abort(reason="authorize_url_timeout")
|
||||
except Exception: # pylint: disable=broad-except
|
||||
_LOGGER.exception("Unexpected error generating auth url")
|
||||
return self.async_abort(reason="authorize_url_fail")
|
||||
return self.async_abort(reason="unknown_authorize_url_generation")
|
||||
|
||||
_LOGGER.debug("Got authorization URL %s", auth_url)
|
||||
return self.async_show_form(
|
||||
|
@ -2,7 +2,7 @@
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]",
|
||||
"authorize_url_fail": "Unknown error generating an authorize url.",
|
||||
"unknown_authorize_url_generation": "[%key:common::config_flow::abort::unknown_authorize_url_generation%]",
|
||||
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
},
|
||||
|
@ -14,7 +14,7 @@
|
||||
},
|
||||
"abort": {
|
||||
"already_configured": "The selected agreement is already configured.",
|
||||
"authorize_url_fail": "Unknown error generating an authorize url.",
|
||||
"unknown_authorize_url_generation": "[%key:common::config_flow::abort::unknown_authorize_url_generation%]",
|
||||
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
|
||||
"missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]",
|
||||
"no_agreements": "This account has no Toon displays.",
|
||||
|
@ -70,7 +70,8 @@
|
||||
"oauth2_missing_configuration": "The component is not configured. Please follow the documentation.",
|
||||
"oauth2_authorize_url_timeout": "Timeout generating authorize URL.",
|
||||
"oauth2_no_url_available": "No URL available. For information about this error, [check the help section]({docs_url})",
|
||||
"reauth_successful": "Re-authentication was successful"
|
||||
"reauth_successful": "Re-authentication was successful",
|
||||
"unknown_authorize_url_generation": "Unknown error generating an authorize url."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ async def test_abort_if_exception_generating_auth_url(hass):
|
||||
flow.hass = hass
|
||||
result = await flow.async_step_init()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["reason"] == "authorize_url_fail"
|
||||
assert result["reason"] == "unknown_authorize_url_generation"
|
||||
|
||||
|
||||
async def test_verify_code_timeout(hass):
|
||||
|
@ -141,7 +141,7 @@ async def test_abort_if_exception_generating_auth_url(hass):
|
||||
|
||||
result = await flow.async_step_user()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["reason"] == "authorize_url_fail"
|
||||
assert result["reason"] == "unknown_authorize_url_generation"
|
||||
|
||||
|
||||
async def test_abort_no_code(hass):
|
||||
|
@ -229,7 +229,7 @@ async def test_abort_no_auth_url(hass, mock_tellduslive):
|
||||
|
||||
result = await flow.async_step_user()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["reason"] == "authorize_url_fail"
|
||||
assert result["reason"] == "unknown_authorize_url_generation"
|
||||
|
||||
|
||||
async def test_abort_if_exception_generating_auth_url(hass, mock_tellduslive):
|
||||
@ -238,7 +238,7 @@ async def test_abort_if_exception_generating_auth_url(hass, mock_tellduslive):
|
||||
|
||||
result = await flow.async_step_user()
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["reason"] == "authorize_url_fail"
|
||||
assert result["reason"] == "unknown_authorize_url_generation"
|
||||
|
||||
|
||||
async def test_discovery_already_configured(hass, mock_tellduslive):
|
||||
|
Loading…
x
Reference in New Issue
Block a user