Rename planner and document rewrite: rewrite_documents moves qualified names of the renamed flow in every flow (ports, inputs, outputs) and dashboard binding (one key table, WIDGET_BINDINGS, shared with the WidgetDef accessors, legacy pages included), published and draft, as plain JSON with both variants above either version; plan_rename reports documents, counts, fingerprint, warnings and refusals; superuser plan routes for flows and dashboards; key residue classifies state as the mapper does; duplicate retargets inputs and outputs too; queue reports its Redis version and other consumers
This commit is contained in:
@@ -7,7 +7,7 @@ import pytest
|
||||
|
||||
from fluksio.flow.controller import FlowController
|
||||
from fluksio.flow.messages import MessageSpec
|
||||
from fluksio.flow.schemas import FlowDef, FlowOrigin, NodeDef
|
||||
from fluksio.flow.schemas import FlowDef, FlowInput, FlowOrigin, NodeDef
|
||||
from fluksio.flow.store import ISSUED_ID, FlowStore, StaleVersion
|
||||
from tests.utils.stores import created
|
||||
|
||||
@@ -166,7 +166,13 @@ def test_resaving_the_published_source_creates_no_draft(store: FlowStore):
|
||||
|
||||
|
||||
def test_a_duplicate_is_a_local_draft_of_what_the_editor_shows(store: FlowStore):
|
||||
flow = a_flow(title="Warm").model_copy(update={"origin": FlowOrigin()})
|
||||
flow = a_flow(title="Warm").model_copy(
|
||||
update={
|
||||
"origin": FlowOrigin(),
|
||||
"inputs": [FlowInput(spec=MessageSpec(name="heating.target"))],
|
||||
"outputs": ["heating.temp", "temp"],
|
||||
}
|
||||
)
|
||||
flow.nodes.append(NodeDef(id="reader", requires=[MessageSpec(name="heating.temp")]))
|
||||
store.write_flow(flow)
|
||||
store.write_node_source("heating", "sensor", SOURCE)
|
||||
@@ -180,6 +186,8 @@ def test_a_duplicate_is_a_local_draft_of_what_the_editor_shows(store: FlowStore)
|
||||
assert ISSUED_ID.fullmatch(copy.id)
|
||||
assert copy.origin is None
|
||||
assert copy.nodes[1].requires[0].name == "heating_copy.temp"
|
||||
assert copy.inputs[0].spec.name == "heating_copy.target"
|
||||
assert copy.outputs == ["heating_copy.temp", "temp"]
|
||||
assert store.has_draft(copy.id) and not store.is_published(copy.id)
|
||||
assert store.read_node_source(copy.id, "sensor", draft=True) == EDITED
|
||||
assert not (store.root / copy.id / "runtime.json").exists()
|
||||
|
||||
Reference in New Issue
Block a user