Implement reverseOrder option for GetWorkflowExecutionHistory and PollForDecisionTask

This commit is contained in:
Jean-Baptiste Barth 2015-10-11 19:14:31 +02:00
commit aa4adbb76e
6 changed files with 40 additions and 15 deletions

View file

@ -44,3 +44,10 @@ def test_poll_for_decision_task_when_none():
# this is the DecisionTask representation you get from the real SWF
# after waiting 60s when there's no decision to be taken
resp.should.equal({"previousStartedEventId": 0, "startedEventId": 0})
@mock_swf
def test_poll_for_decision_task_with_reverse_order():
conn = setup_workflow()
resp = conn.poll_for_decision_task("test-domain", "queue", reverse_order=True)
types = [evt["eventType"] for evt in resp["events"]]
types.should.equal(["DecisionTaskStarted", "DecisionTaskScheduled", "WorkflowExecutionStarted"])

View file

@ -197,8 +197,8 @@ def test_workflow_execution_start_decision_task():
wfe.start_decision_task(dt.task_token, identity="srv01")
dt = wfe.decision_tasks[0]
dt.state.should.equal("STARTED")
wfe.events[-1].event_type.should.equal("DecisionTaskStarted")
wfe.events[-1].identity.should.equal("srv01")
wfe.events()[-1].event_type.should.equal("DecisionTaskStarted")
wfe.events()[-1].identity.should.equal("srv01")
# HistoryEvent

View file

@ -79,10 +79,19 @@ def test_get_workflow_execution_history():
run_id = hsh["runId"]
resp = conn.get_workflow_execution_history("test-domain", run_id, "uid-abcd1234")
resp["events"].should.be.a("list")
evt = resp["events"][0]
evt["eventType"].should.equal("WorkflowExecutionStarted")
types = [evt["eventType"] for evt in resp["events"]]
types.should.equal(["WorkflowExecutionStarted", "DecisionTaskScheduled"])
@mock_swf
def test_get_workflow_execution_history_with_reverse_order():
conn = setup_swf_environment()
hsh = conn.start_workflow_execution("test-domain", "uid-abcd1234", "test-workflow", "v1.0")
run_id = hsh["runId"]
resp = conn.get_workflow_execution_history("test-domain", run_id, "uid-abcd1234",
reverse_order=True)
types = [evt["eventType"] for evt in resp["events"]]
types.should.equal(["DecisionTaskScheduled", "WorkflowExecutionStarted"])
@mock_swf
def test_get_workflow_execution_history_on_non_existent_workflow_execution():