mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Add current step that is in progress (#35272)
This commit is contained in:
parent
56beec1ce9
commit
1c5b4dbd97
@ -94,7 +94,12 @@ class FlowManager(abc.ABC):
|
|||||||
def async_progress(self) -> List[Dict]:
|
def async_progress(self) -> List[Dict]:
|
||||||
"""Return the flows in progress."""
|
"""Return the flows in progress."""
|
||||||
return [
|
return [
|
||||||
{"flow_id": flow.flow_id, "handler": flow.handler, "context": flow.context}
|
{
|
||||||
|
"flow_id": flow.flow_id,
|
||||||
|
"handler": flow.handler,
|
||||||
|
"context": flow.context,
|
||||||
|
"step_id": flow.cur_step["step_id"],
|
||||||
|
}
|
||||||
for flow in self._progress.values()
|
for flow in self._progress.values()
|
||||||
if flow.cur_step is not None
|
if flow.cur_step is not None
|
||||||
]
|
]
|
||||||
|
@ -390,7 +390,12 @@ async def test_get_progress_index(hass, hass_ws_client):
|
|||||||
|
|
||||||
assert response["success"]
|
assert response["success"]
|
||||||
assert response["result"] == [
|
assert response["result"] == [
|
||||||
{"flow_id": form["flow_id"], "handler": "test", "context": {"source": "hassio"}}
|
{
|
||||||
|
"flow_id": form["flow_id"],
|
||||||
|
"handler": "test",
|
||||||
|
"step_id": "account",
|
||||||
|
"context": {"source": "hassio"},
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +58,14 @@ async def test_configure_reuses_handler_instance(manager):
|
|||||||
assert form["errors"]["base"] == "1"
|
assert form["errors"]["base"] == "1"
|
||||||
form = await manager.async_configure(form["flow_id"])
|
form = await manager.async_configure(form["flow_id"])
|
||||||
assert form["errors"]["base"] == "2"
|
assert form["errors"]["base"] == "2"
|
||||||
assert len(manager.async_progress()) == 1
|
assert manager.async_progress() == [
|
||||||
|
{
|
||||||
|
"flow_id": form["flow_id"],
|
||||||
|
"handler": "test",
|
||||||
|
"step_id": "init",
|
||||||
|
"context": {},
|
||||||
|
}
|
||||||
|
]
|
||||||
assert len(manager.mock_created_entries) == 0
|
assert len(manager.mock_created_entries) == 0
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user