Add task lifecycle tests
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
from active_runtime.app.task_lifecycle import TaskLifecycle
|
||||
|
||||
|
||||
def test_owner_approval_button_appears_for_waiting_task():
|
||||
lifecycle = TaskLifecycle()
|
||||
actions = lifecycle.available_actions({"task_id": "t1", "status": "waiting_approval"}, "owner")
|
||||
approve = [a for a in actions if a["action"] == "approve"][0]
|
||||
assert approve["enabled"] is True
|
||||
|
||||
|
||||
def test_block_requires_reason():
|
||||
lifecycle = TaskLifecycle()
|
||||
try:
|
||||
lifecycle.transition({"status": "running"}, "block", "executor")
|
||||
assert False
|
||||
except ValueError:
|
||||
assert True
|
||||
Reference in New Issue
Block a user