Fix decision parameters: attributes are in foo*Decision*Attributes

This commit is contained in:
Jean-Baptiste Barth 2015-10-24 05:10:01 +02:00
parent 417f732b53
commit 918cf8a4e3
2 changed files with 3 additions and 3 deletions

View File

@ -286,7 +286,7 @@ class WorkflowExecution(object):
# handle each decision separately, in order # handle each decision separately, in order
for decision in decisions: for decision in decisions:
decision_type = decision["decisionType"] decision_type = decision["decisionType"]
attributes_key = "{}EventAttributes".format(decapitalize(decision_type)) attributes_key = "{}DecisionAttributes".format(decapitalize(decision_type))
attributes = decision.get(attributes_key, {}) attributes = decision.get(attributes_key, {})
if decision_type == "CompleteWorkflowExecution": if decision_type == "CompleteWorkflowExecution":
self.complete(event_id, attributes.get("result")) self.complete(event_id, attributes.get("result"))

View File

@ -144,7 +144,7 @@ def test_respond_decision_task_completed_with_complete_workflow_execution():
decisions = [{ decisions = [{
"decisionType": "CompleteWorkflowExecution", "decisionType": "CompleteWorkflowExecution",
"completeWorkflowExecutionEventAttributes": {"result": "foo bar"} "completeWorkflowExecutionDecisionAttributes": {"result": "foo bar"}
}] }]
resp = conn.respond_decision_task_completed(task_token, decisions=decisions) resp = conn.respond_decision_task_completed(task_token, decisions=decisions)
resp.should.be.none resp.should.be.none
@ -240,7 +240,7 @@ def test_respond_decision_task_completed_with_fail_workflow_execution():
decisions = [{ decisions = [{
"decisionType": "FailWorkflowExecution", "decisionType": "FailWorkflowExecution",
"failWorkflowExecutionEventAttributes": {"reason": "my rules", "details": "foo"} "failWorkflowExecutionDecisionAttributes": {"reason": "my rules", "details": "foo"}
}] }]
resp = conn.respond_decision_task_completed(task_token, decisions=decisions) resp = conn.respond_decision_task_completed(task_token, decisions=decisions)
resp.should.be.none resp.should.be.none