mirror of
https://github.com/home-assistant/core.git
synced 2026-05-01 22:23:08 +01:00
Add start_reauth helper method to MockConfigEntry (#124767)
* Add start_reauth helper method to MockConfigEntry * Two more
This commit is contained in:
@@ -53,18 +53,14 @@ async def test_authorization_error(
|
||||
|
||||
async def test_reauth_authorization_error(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_devops_client: AsyncMock,
|
||||
) -> None:
|
||||
"""Test we show user form on Azure DevOps authorization error."""
|
||||
mock_devops_client.authorize.return_value = False
|
||||
mock_devops_client.authorized = False
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_REAUTH},
|
||||
data=FIXTURE_USER_INPUT,
|
||||
)
|
||||
|
||||
result = await mock_config_entry.start_reauth_flow(hass)
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth"
|
||||
|
||||
@@ -108,17 +104,14 @@ async def test_connection_error(
|
||||
|
||||
async def test_reauth_connection_error(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_devops_client: AsyncMock,
|
||||
) -> None:
|
||||
"""Test we show user form on Azure DevOps connection error."""
|
||||
mock_devops_client.authorize.side_effect = aiohttp.ClientError
|
||||
mock_devops_client.authorized = False
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_REAUTH},
|
||||
data=FIXTURE_USER_INPUT,
|
||||
)
|
||||
result = await mock_config_entry.start_reauth_flow(hass)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth"
|
||||
@@ -174,11 +167,7 @@ async def test_reauth_project_error(
|
||||
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_REAUTH},
|
||||
data=FIXTURE_USER_INPUT,
|
||||
)
|
||||
result = await mock_config_entry.start_reauth_flow(hass)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth"
|
||||
@@ -205,11 +194,7 @@ async def test_reauth_flow(
|
||||
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_REAUTH},
|
||||
data=FIXTURE_USER_INPUT,
|
||||
)
|
||||
result = await mock_config_entry.start_reauth_flow(hass)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "reauth"
|
||||
|
||||
Reference in New Issue
Block a user