2019-10-03 11:01:21 +00:00
|
|
|
from jeeves.core.executor import Executor
|
|
|
|
from .factories import FlowFactory, TaskFactory
|
|
|
|
|
|
|
|
|
|
|
|
def test_executor_success_task_ok():
|
2019-10-06 11:27:15 +00:00
|
|
|
task = TaskFactory(type="jeeves.core.actions.stub:StubSuccessAction")
|
2019-10-03 11:01:21 +00:00
|
|
|
flow = FlowFactory(tasks=[task])
|
|
|
|
runner = Executor(flow)
|
|
|
|
runner.start()
|
|
|
|
assert runner._execution.steps[0].result
|
|
|
|
assert runner._execution.steps[0].result.success is True
|
|
|
|
assert runner._execution.success is True
|
|
|
|
|
|
|
|
|
|
|
|
def test_executor_non_success_task_ok():
|
2019-10-06 11:27:15 +00:00
|
|
|
task = TaskFactory(type="jeeves.core.actions.stub:StubNonSuccessAction")
|
2019-10-03 11:01:21 +00:00
|
|
|
flow = FlowFactory(tasks=[task])
|
|
|
|
runner = Executor(flow)
|
|
|
|
runner.start()
|
|
|
|
assert runner._execution.steps[0].result
|
|
|
|
assert runner._execution.steps[0].result.success is False
|
|
|
|
assert runner._execution.success is False
|
|
|
|
|
|
|
|
|
|
|
|
def test_executor_uncaught_exception_in_task_ok():
|
2019-10-06 11:27:15 +00:00
|
|
|
task = TaskFactory(type="jeeves.core.actions.stub:StubUncaughtExceptionAction")
|
2019-10-03 11:01:21 +00:00
|
|
|
flow = FlowFactory(tasks=[task])
|
|
|
|
runner = Executor(flow)
|
|
|
|
runner.start()
|
|
|
|
assert runner._execution.steps[0].result
|
|
|
|
assert runner._execution.steps[0].result.success is False
|
|
|
|
assert runner._execution.success is False
|