From 369285b7ca1de06aaa296ea5d51482dad2492d83 Mon Sep 17 00:00:00 2001 From: Laurie O Date: Wed, 26 Feb 2020 01:06:58 +1000 Subject: [PATCH] Don't 0-default previous started event ID Signed-off-by: Laurie O --- moto/swf/models/decision_task.py | 5 +++-- tests/test_swf/models/test_decision_task.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/moto/swf/models/decision_task.py b/moto/swf/models/decision_task.py index c8c9824a2..d7236a0ad 100644 --- a/moto/swf/models/decision_task.py +++ b/moto/swf/models/decision_task.py @@ -15,7 +15,7 @@ class DecisionTask(BaseModel): self.workflow_type = workflow_execution.workflow_type self.task_token = str(uuid.uuid4()) self.scheduled_event_id = scheduled_event_id - self.previous_started_event_id = 0 + self.previous_started_event_id = None self.started_event_id = None self.started_timestamp = None self.start_to_close_timeout = ( @@ -40,10 +40,11 @@ class DecisionTask(BaseModel): hsh = { "events": [evt.to_dict() for evt in events], "taskToken": self.task_token, - "previousStartedEventId": self.previous_started_event_id, "workflowExecution": self.workflow_execution.to_short_dict(), "workflowType": self.workflow_type.to_short_dict(), } + if self.previous_started_event_id is not None: + hsh["previousStartedEventId"] = self.previous_started_event_id if self.started_event_id: hsh["startedEventId"] = self.started_event_id return hsh diff --git a/tests/test_swf/models/test_decision_task.py b/tests/test_swf/models/test_decision_task.py index 0661adffb..8296f0472 100644 --- a/tests/test_swf/models/test_decision_task.py +++ b/tests/test_swf/models/test_decision_task.py @@ -24,7 +24,7 @@ def test_decision_task_full_dict_representation(): fd = dt.to_full_dict() fd["events"].should.be.a("list") - fd["previousStartedEventId"].should.equal(0) + fd.should_not.contain("previousStartedEventId") fd.should_not.contain("startedEventId") fd.should.contain("taskToken") fd["workflowExecution"].should.equal(wfe.to_short_dict())