Flows and dashboards are created by POST under an issued or superuser-pinned id; PUT only updates; deleted flows leave a tombstone with their key; the controller stores by id and runs by key, hooks live under /hooks/<flow id>; a key with state or queued work behind it is refused until cleared

This commit is contained in:
2026-11-02 17:41:23 +01:00
parent fae85f5ecb
commit 08a6376836
63 changed files with 2832 additions and 936 deletions
+21 -16
View File
@@ -7,6 +7,7 @@ from fastapi.testclient import TestClient
from fluksio.api.routes.search import MASK, setting_text
from fluksio.core.config import settings
from tests.utils.flows import put_dashboard, put_flow
PREFIX = f"{settings.API_V1_STR}/search"
FLOWS = f"{settings.API_V1_STR}/flows"
@@ -22,19 +23,20 @@ def test_index_reaches_inside_flows_and_dashboards(
client: TestClient, superuser_token_headers: dict[str, str]
) -> None:
"""A node and a widget are the point: neither is on any list endpoint."""
client.put(
f"{FLOWS}/searchable",
headers=superuser_token_headers,
json={
put_flow(
client,
superuser_token_headers,
{
"name": "searchable",
"title": "Searchable",
"nodes": [{"id": "sensor", "type": "python", "title": "Hall sensor"}],
},
"searchable",
)
client.put(
f"{DASHBOARDS}/hall",
headers=superuser_token_headers,
json={
put_dashboard(
client,
superuser_token_headers,
{
"name": "hall",
"title": "Hall",
"widgets": [
@@ -48,6 +50,7 @@ def test_index_reaches_inside_flows_and_dashboards(
],
"version": 0,
},
"hall",
)
entries = client.get(f"{PREFIX}/", headers=superuser_token_headers).json()
@@ -69,15 +72,16 @@ def test_index_lists_a_flows_inputs_and_outputs(
client: TestClient, superuser_token_headers: dict[str, str]
) -> None:
"""Named by the qualified message, which is the label the canvas draws."""
client.put(
f"{FLOWS}/fit",
headers=superuser_token_headers,
json={
put_flow(
client,
superuser_token_headers,
{
"name": "fit",
"mode": "batch",
"inputs": [{"spec": {"name": "epochs", "dtype": "int"}}],
"outputs": ["accuracy"],
},
"fit",
)
entries = client.get(f"{PREFIX}/", headers=superuser_token_headers).json()
@@ -151,10 +155,10 @@ def test_index_lists_a_nodes_settings(
normal_user_token_headers: dict[str, str],
) -> None:
"""A setting is found by its node and name, with its value beside it."""
client.put(
f"{FLOWS}/tuned",
headers=superuser_token_headers,
json={
put_flow(
client,
superuser_token_headers,
{
"name": "tuned",
"nodes": [
{"id": "gain", "type": "python", "params": {"factor": 2.5}},
@@ -169,6 +173,7 @@ def test_index_lists_a_nodes_settings(
},
],
},
"tuned",
)
def settings_of(headers: dict[str, str]) -> tuple[dict[str, dict], str]: