Ejemplo n.º 1
0
    def test_history_add_event(self):
        descriptions = PicklableMock()
        item = {'type': 'event_type', 'content': {'foo': 'bar'}}
        history = History({}, descriptions, None)
        expected = Event(**item)

        history.add_event(expected)

        self.assertEqual(len(history.get_raw_events()), 1)
        self.assertEqual(history.get_raw_events()[0], expected)
Ejemplo n.º 2
0
    def test_history_clear(self):
        descriptions = PicklableMock()
        items = {
            'events': [{
                'type': 'event_type_1',
                'content': {
                    'foo': 'bar'
                }
            }, {
                'type': 'event_type_2',
                'content': {
                    'foo': 'bar'
                }
            }]
        }
        history = History(items, descriptions, None)
        self.assertEqual(len(history.get_raw_events()), 2)

        history.clear()
        self.assertEqual(len(history.get_raw_events()), 0)