Beispiel #1
0
    def testProcess(self):
        """Tests the Process function."""
        plist_name = 'com.apple.TimeMachine.plist'

        plugin = timemachine.TimeMachinePlugin()
        storage_writer = self._ParsePlistFileWithPlugin(
            plugin, [plist_name], plist_name)

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

        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 = [
            1379165051000000, 1380098455000000, 1380810276000000,
            1381883538000000, 1382647890000000, 1383351739000000,
            1384090020000000, 1385130914000000, 1386265911000000,
            1386689852000000, 1387723091000000, 1388840950000000,
            1388842718000000
        ]
        timestamps = sorted([event.timestamp for event in events])

        self.assertEqual(timestamps, expected_timestamps)

        expected_event_values = {
            'data_type':
            'plist:key',
            'desc': ('TimeMachine Backup in BackUpFast '
                     '(5B33C22B-A4A1-4024-A2F5-C9979C4AAAAA)'),
            'key':
            'item/SnapshotDates',
            'root':
            '/Destinations'
        }

        self.CheckEventValues(storage_writer, events[1], expected_event_values)
Beispiel #2
0
  def testProcess(self):
    """Tests the Process function."""
    plist_name = 'com.apple.TimeMachine.plist'

    plugin = timemachine.TimeMachinePlugin()
    storage_writer = self._ParsePlistFileWithPlugin(
        plugin, [plist_name], plist_name)

    self.assertEqual(storage_writer.number_of_warnings, 0)
    self.assertEqual(storage_writer.number_of_events, 13)

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

    expected_timestamps = [
        1379165051000000, 1380098455000000, 1380810276000000, 1381883538000000,
        1382647890000000, 1383351739000000, 1384090020000000, 1385130914000000,
        1386265911000000, 1386689852000000, 1387723091000000, 1388840950000000,
        1388842718000000]
    timestamps = sorted([event.timestamp for event in events])

    self.assertEqual(timestamps, expected_timestamps)

    expected_description = (
        'TimeMachine Backup in BackUpFast '
        '(5B33C22B-A4A1-4024-A2F5-C9979C4AAAAA)')

    expected_event_values = {
        'desc': expected_description,
        'key': 'item/SnapshotDates',
        'root': '/Destinations'}

    self.CheckEventValues(storage_writer, events[1], expected_event_values)

    expected_message = '/Destinations/item/SnapshotDates {0:s}'.format(
        expected_description)
    expected_short_message = '{0:s}...'.format(expected_message[:77])

    event_data = self._GetEventDataOfEvent(storage_writer, events[0])
    self._TestGetMessageStrings(
        event_data, expected_message, expected_short_message)
Beispiel #3
0
    def testProcess(self):
        """Tests the Process function."""
        plist_name = u'com.apple.TimeMachine.plist'

        plugin_object = timemachine.TimeMachinePlugin()
        storage_writer = self._ParsePlistFileWithPlugin(
            plugin_object, [plist_name], plist_name)

        self.assertEqual(len(storage_writer.events), 13)

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

        expected_timestamps = [
            1379165051000000, 1380098455000000, 1380810276000000,
            1381883538000000, 1382647890000000, 1383351739000000,
            1384090020000000, 1385130914000000, 1386265911000000,
            1386689852000000, 1387723091000000, 1388840950000000,
            1388842718000000
        ]
        timestamps = sorted(
            [event_object.timestamp for event_object in events])

        self.assertEqual(timestamps, expected_timestamps)

        event_object = events[0]
        self.assertEqual(event_object.root, u'/Destinations')
        self.assertEqual(event_object.key, u'item/SnapshotDates')

        expected_description = (u'TimeMachine Backup in BackUpFast '
                                u'(5B33C22B-A4A1-4024-A2F5-C9979C4AAAAA)')
        self.assertEqual(event_object.desc, expected_description)

        expected_message = u'/Destinations/item/SnapshotDates {0:s}'.format(
            expected_description)
        expected_message_short = u'{0:s}...'.format(expected_message[:77])
        self._TestGetMessageStrings(event_object, expected_message,
                                    expected_message_short)
Beispiel #4
0
 def setUp(self):
   """Makes preparations before running an individual test."""
   self._plugin = timemachine.TimeMachinePlugin()
   self._parser = plist.PlistParser()
Beispiel #5
0
 def setUp(self):
   """Sets up the needed objects used throughout the test."""
   self._plugin = timemachine.TimeMachinePlugin()
   self._parser = plist.PlistParser()
Beispiel #6
0
 def setUp(self):
     """Sets up the needed objects used throughout the test."""
     self._plugin = timemachine.TimeMachinePlugin(None)
     self._parser = plist.PlistParser(event.PreprocessObject(), None)