generated from coulomb/repo-seed
Harden flow advancement exit assertions
This commit is contained in:
@@ -64,6 +64,50 @@ def test_failing_exit_assertion_identifies_blocking_assertion():
|
||||
assert result.blocking_assertions[0].actual == ["done", "todo"]
|
||||
|
||||
|
||||
def test_can_reach_checks_current_exit_assertions_before_target_entry():
|
||||
flow = FlowDef(
|
||||
id="workstream.test",
|
||||
entity_type="workstream",
|
||||
workstations=[
|
||||
WorkstationDef(
|
||||
name="active",
|
||||
exit_assertions=[
|
||||
AssertionDef(
|
||||
id="dependencies.all_complete",
|
||||
target="dependencies.*.workstation",
|
||||
op="all_eq",
|
||||
value=["finished", "archived"],
|
||||
)
|
||||
],
|
||||
),
|
||||
WorkstationDef(
|
||||
name="finished",
|
||||
entry_assertions=[
|
||||
AssertionDef(
|
||||
id="tasks.all_done",
|
||||
target="tasks.*.status",
|
||||
op="all_eq",
|
||||
value=["done", "cancelled"],
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
can_reach, failures = FlowEngine().can_reach(
|
||||
{
|
||||
"status": "active",
|
||||
"tasks": [{"status": "done"}],
|
||||
"dependencies": [{"workstation": "active"}],
|
||||
},
|
||||
flow,
|
||||
"finished",
|
||||
)
|
||||
|
||||
assert can_reach is False
|
||||
assert [item.id for item in failures] == ["dependencies.all_complete"]
|
||||
|
||||
|
||||
def test_custom_op_callable_is_invoked():
|
||||
calls = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user