def testParse(self): """Tests the Parse function.""" parser = opera.OperaTypedHistoryParser() storage_writer = self._ParseFile(['typed_history.xml'], parser) self.assertEqual(storage_writer.number_of_events, 4) self.assertEqual(storage_writer.number_of_extraction_warnings, 0) self.assertEqual(storage_writer.number_of_recovery_warnings, 0) events = list(storage_writer.GetEvents()) expected_event_values = { 'data_type': 'opera:history:typed_entry', 'date_time': '2013-11-11 23:45:27', 'entry_selection': 'Filled from autocomplete.', 'url': 'plaso.kiddaland.net'} self.CheckEventValues(storage_writer, events[0], expected_event_values) expected_event_values = { 'data_type': 'opera:history:typed_entry', 'date_time': '2013-11-11 22:46:07', 'entry_selection': 'Manually typed.', 'url': 'theonion.com'} self.CheckEventValues(storage_writer, events[3], expected_event_values)
def testParse(self): """Tests the Parse function.""" parser = opera.OperaTypedHistoryParser() storage_writer = self._ParseFile(['typed_history.xml'], parser) self.assertEqual(storage_writer.number_of_warnings, 0) self.assertEqual(storage_writer.number_of_events, 4) events = list(storage_writer.GetEvents()) event = events[0] self.CheckTimestamp(event.timestamp, '2013-11-11 23:45:27.000000') self.assertEqual(event.entry_selection, 'Filled from autocomplete.') expected_string = 'plaso.kiddaland.net (Filled from autocomplete.)' self._TestGetMessageStrings(event, expected_string, expected_string) event = events[3] self.CheckTimestamp(event.timestamp, '2013-11-11 22:46:07.000000') self.assertEqual(event.entry_selection, 'Manually typed.') expected_string = 'theonion.com (Manually typed.)' self._TestGetMessageStrings(event, expected_string, expected_string)
def testParse(self): """Tests the Parse function.""" parser = opera.OperaTypedHistoryParser() storage_writer = self._ParseFile(['typed_history.xml'], parser) self.assertEqual(storage_writer.number_of_warnings, 0) self.assertEqual(storage_writer.number_of_events, 4) events = list(storage_writer.GetEvents()) expected_event_values = { 'entry_selection': 'Filled from autocomplete.', 'timestamp': '2013-11-11 23:45:27.000000' } self.CheckEventValues(storage_writer, events[0], expected_event_values) expected_string = 'plaso.kiddaland.net (Filled from autocomplete.)' event_data = self._GetEventDataOfEvent(storage_writer, events[0]) self._TestGetMessageStrings(event_data, expected_string, expected_string) expected_event_values = { 'entry_selection': 'Manually typed.', 'timestamp': '2013-11-11 22:46:07.000000' } self.CheckEventValues(storage_writer, events[3], expected_event_values) expected_string = 'theonion.com (Manually typed.)' event_data = self._GetEventDataOfEvent(storage_writer, events[3]) self._TestGetMessageStrings(event_data, expected_string, expected_string)
def testParse(self): """Tests the Parse function.""" parser_object = opera.OperaTypedHistoryParser() test_file = self._GetTestFilePath([u'typed_history.xml']) event_queue_consumer = self._ParseFile(parser_object, test_file) event_objects = self._GetEventObjectsFromQueue(event_queue_consumer) self.assertEqual(len(event_objects), 4) event_object = event_objects[0] expected_timestamp = timelib.Timestamp.CopyFromString( u'2013-11-11 23:45:27') self.assertEqual(event_object.timestamp, expected_timestamp) self.assertEqual(event_object.entry_selection, u'Filled from autocomplete.') expected_string = u'plaso.kiddaland.net (Filled from autocomplete.)' self._TestGetMessageStrings(event_object, expected_string, expected_string) event_object = event_objects[3] expected_timestamp = timelib.Timestamp.CopyFromString( u'2013-11-11 22:46:07') self.assertEqual(event_object.timestamp, expected_timestamp) self.assertEqual(event_object.entry_selection, u'Manually typed.') expected_string = u'theonion.com (Manually typed.)' self._TestGetMessageStrings(event_object, expected_string, expected_string)
def setUp(self): """Sets up the needed objects used throughout the test.""" self._parser = opera.OperaTypedHistoryParser()
def setUp(self): """Sets up the needed objects used throughout the test.""" pre_obj = event.PreprocessObject() self._parser = opera.OperaTypedHistoryParser(pre_obj, None)
def setUp(self): """Makes preparations before running an individual test.""" self._parser = opera.OperaTypedHistoryParser()