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
+10 -8
View File
@@ -19,7 +19,8 @@ from fluksio.flow.nodes import Node
from fluksio.flow.pipeline import Pipeline
from fluksio.flow.schemas import FlowDef, NodeDef
from fluksio.flow.state import MemoryState
from fluksio.flow.store import FlowStore, StaleVersion
from fluksio.flow.store import ISSUED_ID, FlowStore, StaleVersion
from tests.utils.stores import created
@pytest.fixture
@@ -93,25 +94,25 @@ def test_discarding_leaves_what_is_published(store: DashboardStore):
def test_a_new_dashboard_is_a_draft_until_it_is_published(store: DashboardStore):
"""Creating one does not put it on a wall; publishing is what does."""
created = store.write_draft(default_dashboard("house"), 0)
made = created(store, default_dashboard("house"))
assert not store.is_published("house")
with pytest.raises(DashboardNotFound):
store.read("house")
assert store.read("house", draft=True).title == created.title
assert store.read("house", draft=True).title == made.title
# Listed all the same, so the editor can find what it just made.
assert [(d.name, d.has_draft, d.version) for d in store.list()] == [
("house", True, created.version)
("house", True, made.version)
]
store.publish("house", created.version)
store.publish("house", made.version)
assert store.is_published("house")
assert store.read("house").title == created.title
assert store.read("house").title == made.title
def test_an_unpublished_dashboard_can_be_deleted(store: DashboardStore):
store.write_draft(default_dashboard("house"), 0)
created(store, default_dashboard("house"))
store.delete("house")
assert not store.exists("house")
@@ -128,7 +129,8 @@ def test_a_duplicate_is_an_unpublished_copy_of_the_working_copy(
copy = store.duplicate("house")
assert (copy.name, copy.title, copy.version) == ("house_copy", "Edited (copy)", 1)
assert store.has_draft("house_copy") and not store.is_published("house_copy")
assert ISSUED_ID.fullmatch(copy.id)
assert store.has_draft(copy.id) and not store.is_published(copy.id)
assert store.read("house", draft=True).version == edited.version
assert store.duplicate("house").name == "house_copy_2"