Пример #1
0
 def test_has_next(self):
     helper = HistoryHelper(self.events)
     self.assertTrue(helper.has_next())
     helper.next()
     self.assertTrue(helper.has_next())
     helper.next()
     self.assertTrue(helper.has_next())
     helper.next()
     self.assertFalse(helper.has_next())
Пример #2
0
    def test_decision_event(self):
        helper = HistoryHelper(self.events)
        self.assertTrue(helper.has_next())

        expected_decisions = [
            ([
                EventType.WorkflowExecutionStarted,
                EventType.DecisionTaskScheduled
            ], [EventType.ActivityTaskScheduled]),
            ([
                EventType.ActivityTaskStarted, EventType.ActivityTaskCompleted,
                EventType.DecisionTaskScheduled
            ], [EventType.ActivityTaskScheduled]),
            ([
                EventType.ActivityTaskStarted, EventType.ActivityTaskCompleted,
                EventType.DecisionTaskScheduled
            ], []),
        ]

        for expected_events, expected_decision_events in expected_decisions:
            e = helper.next()
            self.assertEqual(expected_events,
                             list(map(lambda x: x.event_type, e.events)))
            self.assertEqual(
                expected_decision_events,
                list(map(lambda x: x.event_type, e.decision_events)))