mirror of
https://github.com/home-assistant/core.git
synced 2026-09-24 23:41:48 -05:00
Split the Syncthing user flow init from its data (#180662)
This commit is contained in:
@@ -36,9 +36,14 @@ async def test_flow_successful(hass: HomeAssistant) -> None:
|
||||
) as mock_setup_entry,
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": "user"},
|
||||
data=MOCK_ENTRY,
|
||||
DOMAIN, context={"source": "user"}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input=MOCK_ENTRY
|
||||
)
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == URL
|
||||
@@ -54,9 +59,14 @@ async def test_flow_already_configured(
|
||||
"""Test the server ID is already configured."""
|
||||
with patch("aiosyncthing.system.System.status", return_value={"myID": SERVER_ID}):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": "user"},
|
||||
data=MOCK_ENTRY,
|
||||
DOMAIN, context={"source": "user"}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input=MOCK_ENTRY
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
@@ -68,9 +78,14 @@ async def test_flow_invalid_auth(hass: HomeAssistant) -> None:
|
||||
|
||||
with patch("aiosyncthing.system.System.status", side_effect=UnauthorizedError):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": "user"},
|
||||
data=MOCK_ENTRY,
|
||||
DOMAIN, context={"source": "user"}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input=MOCK_ENTRY
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
@@ -82,9 +97,14 @@ async def test_flow_cannot_connect(hass: HomeAssistant) -> None:
|
||||
|
||||
with patch("aiosyncthing.system.System.status", side_effect=Exception):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": "user"},
|
||||
data=MOCK_ENTRY,
|
||||
DOMAIN, context={"source": "user"}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input=MOCK_ENTRY
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
|
||||
Reference in New Issue
Block a user