Skip to content

Commit

Permalink
Add unknown_authorize_url_generation to base strings for config flows (
Browse files Browse the repository at this point in the history
  • Loading branch information
springstan authored Nov 24, 2020
1 parent 3dd14e0 commit 5a892e8
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/nest/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ async def async_step_link(self, user_input=None):
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",
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/nest/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/point/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async def async_step_auth(self, user_input=None):
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},
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/point/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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%]"
}
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/tellduslive/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ async def async_step_auth(self, user_input=None):
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(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tellduslive/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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%]"
},
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/toon/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/components/nest/test_config_flow_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/components/point/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions tests/components/tellduslive/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down

0 comments on commit 5a892e8

Please sign in to comment.