moto/tests/test_swf/models/test_history_event.py

32 lines
1004 B
Python
Raw Normal View History

from freezegun import freeze_time
2021-10-18 19:44:29 +00:00
import sure # noqa # pylint: disable=unused-import
from moto.swf.models import HistoryEvent
@freeze_time("2015-01-01 12:00:00")
def test_history_event_creation():
he = HistoryEvent(123, "DecisionTaskStarted", scheduled_event_id=2)
he.event_id.should.equal(123)
he.event_type.should.equal("DecisionTaskStarted")
he.event_timestamp.should.equal(1420113600.0)
2016-02-02 19:02:37 +00:00
@freeze_time("2015-01-01 12:00:00")
def test_history_event_to_dict_representation():
he = HistoryEvent(123, "DecisionTaskStarted", scheduled_event_id=2)
2019-10-31 15:44:26 +00:00
he.to_dict().should.equal(
{
"eventId": 123,
"eventType": "DecisionTaskStarted",
"eventTimestamp": 1420113600.0,
"decisionTaskStartedEventAttributes": {"scheduledEventId": 2},
}
2019-10-31 15:44:26 +00:00
)
2016-02-02 19:02:37 +00:00
def test_history_event_breaks_on_initialization_if_not_implemented():
2019-10-31 15:44:26 +00:00
HistoryEvent.when.called_with(123, "UnknownHistoryEvent").should.throw(
NotImplementedError
)