Add missing attributes in DescribeWorkflowExecution responses

This commit is contained in:
Jean-Baptiste Barth 2015-10-31 21:13:44 +01:00
commit 98948a01c8
3 changed files with 32 additions and 2 deletions

View file

@ -195,10 +195,15 @@ def test_workflow_execution_fail():
wfe.events()[-1].details.should.equal("some details")
wfe.events()[-1].reason.should.equal("my rules")
@freeze_time("2015-01-01 12:00:00")
def test_workflow_execution_schedule_activity_task():
wfe = make_workflow_execution()
wfe.latest_activity_task_timestamp.should.be.none
wfe.schedule_activity_task(123, VALID_ACTIVITY_TASK_ATTRIBUTES)
wfe.latest_activity_task_timestamp.should.equal(1420110000.0)
wfe.open_counts["openActivityTasks"].should.equal(1)
last_event = wfe.events()[-1]
last_event.event_type.should.equal("ActivityTaskScheduled")
@ -305,7 +310,9 @@ def test_workflow_execution_schedule_activity_task_failure_triggers_new_decision
wfe.start()
task_token = wfe.decision_tasks[-1].task_token
wfe.start_decision_task(task_token)
wfe.complete_decision_task(task_token, decisions=[
wfe.complete_decision_task(task_token,
execution_context="free-form execution context",
decisions=[
{
"decisionType": "ScheduleActivityTask",
"scheduleActivityTaskDecisionAttributes": {
@ -322,6 +329,7 @@ def test_workflow_execution_schedule_activity_task_failure_triggers_new_decision
},
])
wfe.latest_execution_context.should.equal("free-form execution context")
wfe.open_counts["openActivityTasks"].should.equal(0)
wfe.open_counts["openDecisionTasks"].should.equal(1)
last_events = wfe.events()[-3:]

View file

@ -1,4 +1,5 @@
import boto
from freezegun import freeze_time
from sure import expect
from moto import mock_swf
@ -83,7 +84,10 @@ def test_respond_decision_task_completed_with_no_decision():
resp = conn.poll_for_decision_task("test-domain", "queue")
task_token = resp["taskToken"]
resp = conn.respond_decision_task_completed(task_token)
resp = conn.respond_decision_task_completed(
task_token,
execution_context="free-form context",
)
resp.should.be.none
resp = conn.get_workflow_execution_history("test-domain", conn.run_id, "uid-abcd1234")
@ -96,10 +100,14 @@ def test_respond_decision_task_completed_with_no_decision():
])
evt = resp["events"][-1]
evt["decisionTaskCompletedEventAttributes"].should.equal({
"executionContext": "free-form context",
"scheduledEventId": 2,
"startedEventId": 3,
})
resp = conn.describe_workflow_execution("test-domain", conn.run_id, "uid-abcd1234")
resp["latestExecutionContext"].should.equal("free-form context")
@mock_swf
def test_respond_decision_task_completed_with_wrong_token():
conn = setup_workflow()
@ -257,6 +265,7 @@ def test_respond_decision_task_completed_with_fail_workflow_execution():
attrs["details"].should.equal("foo")
@mock_swf
@freeze_time("2015-01-01 12:00:00")
def test_respond_decision_task_completed_with_schedule_activity_task():
conn = setup_workflow()
resp = conn.poll_for_decision_task("test-domain", "queue")
@ -302,3 +311,6 @@ def test_respond_decision_task_completed_with_schedule_activity_task():
"name": "my-task-list"
},
})
resp = conn.describe_workflow_execution("test-domain", conn.run_id, "uid-abcd1234")
resp["latestActivityTaskTimestamp"].should.equal(1420110000.0)