def testParse(self): """Tests the Parse function.""" parser = chrome_cache.ChromeCacheParser() storage_writer = self._ParseFile(['chrome_cache', 'index'], parser) self.assertEqual(storage_writer.number_of_warnings, 0) self.assertEqual(storage_writer.number_of_events, 217) events = list(storage_writer.GetEvents()) expected_original_url = ( 'https://s.ytimg.com/yts/imgbin/player-common-vfliLfqPT.webp') expected_event_values = { 'timestamp': '2014-04-30 16:44:36.226091', 'original_url': expected_original_url } self.CheckEventValues(storage_writer, events[0], expected_event_values) expected_message = 'Original URL: {0:s}'.format(expected_original_url) event_data = self._GetEventDataOfEvent(storage_writer, events[0]) self._TestGetMessageStrings(event_data, expected_message, expected_message)
def testParse(self): """Tests the Parse function.""" parser = chrome_cache.ChromeCacheParser() storage_writer = self._ParseFile(['chrome_cache', 'index'], parser) number_of_events = storage_writer.GetNumberOfAttributeContainers('event') self.assertEqual(number_of_events, 217) number_of_warnings = storage_writer.GetNumberOfAttributeContainers( 'extraction_warning') self.assertEqual(number_of_warnings, 0) number_of_warnings = storage_writer.GetNumberOfAttributeContainers( 'recovery_warning') self.assertEqual(number_of_warnings, 0) events = list(storage_writer.GetEvents()) expected_event_values = { 'data_type': 'chrome:cache:entry', 'date_time': '2014-04-30 16:44:36.226091', 'original_url': ( 'https://s.ytimg.com/yts/imgbin/player-common-vfliLfqPT.webp')} self.CheckEventValues(storage_writer, events[0], expected_event_values)
def testParse(self): """Tests the Parse function.""" parser = chrome_cache.ChromeCacheParser() storage_writer = self._ParseFile(['chrome_cache', 'index'], parser) self.assertEqual(storage_writer.number_of_events, 217) events = list(storage_writer.GetEvents()) event = events[0] self.CheckTimestamp(event.timestamp, '2014-04-30 16:44:36.226091') expected_original_url = ( 'https://s.ytimg.com/yts/imgbin/player-common-vfliLfqPT.webp') self.assertEqual(event.original_url, expected_original_url) expected_message = 'Original URL: {0:s}'.format(expected_original_url) self._TestGetMessageStrings(event, expected_message, expected_message)
def testParse(self): """Tests the Parse function.""" parser_object = chrome_cache.ChromeCacheParser() test_file = self._GetTestFilePath([u'chrome_cache', u'index']) event_queue_consumer = self._ParseFile(parser_object, test_file) event_objects = self._GetEventObjectsFromQueue(event_queue_consumer) self.assertEqual(len(event_objects), 217) event_object = event_objects[0] expected_timestamp = timelib.Timestamp.CopyFromString( u'2014-04-30 16:44:36.226091') self.assertEqual(event_object.timestamp, expected_timestamp) expected_original_url = ( u'https://s.ytimg.com/yts/imgbin/player-common-vfliLfqPT.webp') self.assertEqual(event_object.original_url, expected_original_url) expected_string = u'Original URL: {0:s}'.format(expected_original_url) self._TestGetMessageStrings(event_object, expected_string, expected_string)
def setUp(self): """Sets up the needed objects used throughout the test.""" pre_obj = event.PreprocessObject() self._parser = chrome_cache.ChromeCacheParser(pre_obj, None)
def setUp(self): """Sets up the needed objects used throughout the test.""" self._parser = chrome_cache.ChromeCacheParser()
def setUp(self): """Makes preparations before running an individual test.""" self._parser = chrome_cache.ChromeCacheParser()