def testPushEvent(self): """Tests the PushEvent function.""" event_heap = output_engine.PsortEventHeap() self.assertEqual(len(event_heap._heap), 0) event, event_data, event_data_stream = ( containers_test_lib.CreateEventFromValues(self._TEST_EVENTS[0])) event_heap.PushEvent(event, event_data, event_data_stream) self.assertEqual(len(event_heap._heap), 1)
def testGetEventIdentifiers(self): """Tests the _GetEventIdentifiers function.""" event_heap = output_engine.PsortEventHeap() event, event_data, event_data_stream = ( containers_test_lib.CreateEventFromValues(self._TEST_EVENTS[0])) macb_group_identifier, content_identifier = event_heap._GetEventIdentifiers( event, event_data, event_data_stream) expected_identifier = 'data_type: test:event' self.assertEqual(macb_group_identifier, expected_identifier) expected_identifier = 'Metadata Modification Time, data_type: test:event' self.assertEqual(content_identifier, expected_identifier)
def testPopEvents(self): """Tests the PopEvents function.""" event_heap = output_engine.PsortEventHeap() self.assertEqual(len(event_heap._heap), 0) test_events = list(event_heap.PopEvents()) self.assertEqual(len(test_events), 0) for event, event_data, event_data_stream in ( containers_test_lib.CreateEventsFromValues(self._TEST_EVENTS)): event_heap.PushEvent(event, event_data, event_data_stream) self.assertEqual(len(event_heap._heap), 2) test_events = list(event_heap.PopEvents()) self.assertEqual(len(test_events), 2) self.assertEqual(len(event_heap._heap), 0)
def testNumberOfEvents(self): """Tests the number_of_events property.""" event_heap = output_engine.PsortEventHeap() self.assertEqual(event_heap.number_of_events, 0)