Improve google calendar config flow timeout error messages (#75364)
This commit is contained in:
parent
943e0b9cf7
commit
ca5065a627
3 changed files with 24 additions and 1 deletions
|
@ -242,7 +242,7 @@ async def test_code_error(
|
|||
mock_code_flow: Mock,
|
||||
component_setup: ComponentSetup,
|
||||
) -> None:
|
||||
"""Test successful creds setup."""
|
||||
"""Test server error setting up the oauth flow."""
|
||||
assert await component_setup()
|
||||
|
||||
with patch(
|
||||
|
@ -256,6 +256,25 @@ async def test_code_error(
|
|||
assert result.get("reason") == "oauth_error"
|
||||
|
||||
|
||||
async def test_timeout_error(
|
||||
hass: HomeAssistant,
|
||||
mock_code_flow: Mock,
|
||||
component_setup: ComponentSetup,
|
||||
) -> None:
|
||||
"""Test timeout error setting up the oauth flow."""
|
||||
assert await component_setup()
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.google.api.OAuth2WebServerFlow.step1_get_device_and_user_codes",
|
||||
side_effect=TimeoutError(),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result.get("type") == "abort"
|
||||
assert result.get("reason") == "timeout_connect"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("code_expiration_delta", [datetime.timedelta(seconds=50)])
|
||||
async def test_expired_after_exchange(
|
||||
hass: HomeAssistant,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue