Implement CompleteWorkflowExecution decision
This commit is contained in:
parent
d97c770849
commit
381eb5eb0f
4 changed files with 70 additions and 16 deletions
|
|
@ -134,3 +134,26 @@ def test_respond_decision_task_completed_with_task_already_completed():
|
|||
conn.respond_decision_task_completed.when.called_with(
|
||||
task_token
|
||||
).should.throw(SWFUnknownResourceFault)
|
||||
|
||||
@mock_swf
|
||||
def test_respond_decision_task_completed_with_complete_workflow_execution():
|
||||
conn = setup_workflow()
|
||||
resp = conn.poll_for_decision_task("test-domain", "queue")
|
||||
task_token = resp["taskToken"]
|
||||
|
||||
decisions = [{
|
||||
"decisionType": "CompleteWorkflowExecution",
|
||||
"completeWorkflowExecutionEventAttributes": {}
|
||||
}]
|
||||
resp = conn.respond_decision_task_completed(task_token, decisions=decisions)
|
||||
resp.should.be.none
|
||||
|
||||
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
|
||||
types = [evt["eventType"] for evt in resp["events"]]
|
||||
types.should.equal([
|
||||
"WorkflowExecutionStarted",
|
||||
"DecisionTaskScheduled",
|
||||
"DecisionTaskStarted",
|
||||
"DecisionTaskCompleted",
|
||||
"WorkflowExecutionCompleted",
|
||||
])
|
||||
|
|
|
|||
|
|
@ -209,6 +209,16 @@ def test_workflow_execution_history_events_ids():
|
|||
ids = [evt.event_id for evt in wfe.events()]
|
||||
ids.should.equal([1, 2, 3])
|
||||
|
||||
def test_workflow_execution_complete():
|
||||
wft = get_basic_workflow_type()
|
||||
wfe = WorkflowExecution(wft, "ab1234")
|
||||
wfe.complete(123, result="foo")
|
||||
|
||||
wfe.execution_status.should.equal("CLOSED")
|
||||
wfe.events()[-1].event_type.should.equal("WorkflowExecutionCompleted")
|
||||
wfe.events()[-1].decision_task_completed_event_id.should.equal(123)
|
||||
wfe.events()[-1].result.should.equal("foo")
|
||||
|
||||
|
||||
# HistoryEvent
|
||||
@freeze_time("2015-01-01 12:00:00")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue