Exemple #1
0
    def testProcess(self):
        """Tests the Process function."""
        plist_name = 'VolumeConfiguration.plist'

        plugin = spotlight_volume.SpotlightVolumePlugin()
        storage_writer = self._ParsePlistFileWithPlugin(
            plugin, [plist_name], plist_name)

        self.assertEqual(storage_writer.number_of_errors, 0)
        self.assertEqual(storage_writer.number_of_events, 2)

        # The order in which PlistParser generates events is nondeterministic
        # hence we sort the events.
        events = list(storage_writer.GetSortedEvents())

        expected_timestamps = [1369657656000000, 1372139683000000]
        timestamps = sorted([event.timestamp for event in events])

        self.assertEqual(timestamps, expected_timestamps)

        event = events[1]

        self.assertEqual(event.key, '')
        self.assertEqual(event.root, '/Stores')

        expected_description = (
            'Spotlight Volume 4D4BFEB5-7FE6-4033-AAAA-AAAABBBBCCCCDDDD '
            '(/.MobileBackups) activated.')
        self.assertEqual(event.desc, expected_description)

        expected_message = '/Stores/ {0:s}'.format(expected_description)
        expected_short_message = '{0:s}...'.format(expected_message[:77])
        self._TestGetMessageStrings(event, expected_message,
                                    expected_short_message)
Exemple #2
0
    def testProcess(self):
        """Tests the Process function."""
        plist_name = 'VolumeConfiguration.plist'

        plugin = spotlight_volume.SpotlightVolumePlugin()
        storage_writer = self._ParsePlistFileWithPlugin(
            plugin, [plist_name], plist_name)

        number_of_events = storage_writer.GetNumberOfAttributeContainers(
            'event')
        self.assertEqual(number_of_events, 2)

        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)

        # The order in which PlistParser generates events is nondeterministic
        # hence we sort the events.
        events = list(storage_writer.GetSortedEvents())

        expected_timestamps = [1369657656000000, 1372139683000000]
        timestamps = sorted([event.timestamp for event in events])

        self.assertEqual(timestamps, expected_timestamps)

        expected_event_values = {
            'data_type':
            'plist:key',
            'desc':
            ('Spotlight Volume 4D4BFEB5-7FE6-4033-AAAA-AAAABBBBCCCCDDDD '
             '(/.MobileBackups) activated.'),
            'key':
            '',
            'root':
            '/Stores'
        }

        self.CheckEventValues(storage_writer, events[1], expected_event_values)
Exemple #3
0
 def setUp(self):
     """Makes preparations before running an individual test."""
     self._plugin = spotlight_volume.SpotlightVolumePlugin()
     self._parser = plist.PlistParser()
Exemple #4
0
 def setUp(self):
     """Sets up the needed objects used throughout the test."""
     self._plugin = spotlight_volume.SpotlightVolumePlugin()
     self._parser = plist.PlistParser()
Exemple #5
0
 def setUp(self):
     """Sets up the needed objects used throughout the test."""
     self._plugin = spotlight_volume.SpotlightVolumePlugin(None)
     self._parser = plist.PlistParser(event.PreprocessObject(), None)