Пример #1
0
    def testProcess(self):
        """Tests the Process function."""
        plist_file = ('com.apple.coreservices.appleidauthenticationinfo.'
                      'ABC0ABC1-ABC0-ABC0-ABC0-ABC0ABC1ABC2.plist')
        plist_name = plist_file

        plugin = appleaccount.AppleAccountPlugin()
        storage_writer = self._ParsePlistFileWithPlugin(
            plugin, [plist_name], plist_name)

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

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

        expected_timestamps = [
            1372106802000000, 1387980032000000, 1387980032000000
        ]
        timestamps = sorted([event.timestamp for event in events])

        self.assertEqual(timestamps, expected_timestamps)

        expected_description = (
            'Configured Apple account [email protected] (Joaquin Moreno Garijo)'
        )

        expected_event_values = {
            'desc': expected_description,
            'key': '*****@*****.**',
            'root': '/Accounts'
        }

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

        expected_message = '/Accounts/[email protected] {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)

        expected_event_values = {
            'desc': ('Connected Apple account '
                     '[email protected] (Joaquin Moreno Garijo)')
        }

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

        expected_event_values = {
            'desc': ('Last validation Apple account '
                     '[email protected] (Joaquin Moreno Garijo)')
        }

        self.CheckEventValues(storage_writer, events[2], expected_event_values)
Пример #2
0
    def testProcess(self):
        """Tests the Process function."""
        plist_file = ('com.apple.coreservices.appleidauthenticationinfo.'
                      'ABC0ABC1-ABC0-ABC0-ABC0-ABC0ABC1ABC2.plist')
        plist_name = plist_file

        plugin = appleaccount.AppleAccountPlugin()
        storage_writer = self._ParsePlistFileWithPlugin(
            plugin, [plist_name], plist_name)

        self.assertEqual(storage_writer.number_of_events, 3)
        self.assertEqual(storage_writer.number_of_extraction_warnings, 0)
        self.assertEqual(storage_writer.number_of_recovery_warnings, 0)

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

        expected_event_values = {
            'data_type':
            'plist:key',
            'date_time':
            '2013-06-24 20:46:42.000000',
            'desc':
            ('Configured Apple account [email protected] (Joaquin Moreno '
             'Garijo)'),
            'key':
            '*****@*****.**',
            'root':
            '/Accounts'
        }

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

        expected_event_values = {
            'data_type':
            'plist:key',
            'date_time':
            '2013-12-25 14:00:32.000000',
            'desc': ('Connected Apple account '
                     '[email protected] (Joaquin Moreno Garijo)')
        }

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

        expected_event_values = {
            'data_type':
            'plist:key',
            'date_time':
            '2013-12-25 14:00:32.000000',
            'desc': ('Last validation Apple account '
                     '[email protected] (Joaquin Moreno Garijo)')
        }

        self.CheckEventValues(storage_writer, events[2], expected_event_values)
Пример #3
0
    def testProcess(self):
        """Tests the Process function."""
        plist_file = (u'com.apple.coreservices.appleidauthenticationinfo.'
                      u'ABC0ABC1-ABC0-ABC0-ABC0-ABC0ABC1ABC2.plist')
        plist_name = plist_file

        plugin_object = appleaccount.AppleAccountPlugin()
        storage_writer = self._ParsePlistFileWithPlugin(
            plugin_object, [plist_name], plist_name)

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

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

        expected_timestamps = [
            1372106802000000, 1387980032000000, 1387980032000000
        ]
        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'/Accounts')
        self.assertEqual(event_object.key, u'*****@*****.**')

        expected_description = (
            u'Configured Apple account [email protected] (Joaquin Moreno Garijo)'
        )
        self.assertEqual(event_object.desc, expected_description)

        expected_message = u'/Accounts/[email protected] {0:s}'.format(
            expected_description)
        expected_message_short = u'{0:s}...'.format(expected_message[:77])
        self._TestGetMessageStrings(event_object, expected_message,
                                    expected_message_short)

        event_object = events[1]
        expected_description = (u'Connected Apple account '
                                u'[email protected] (Joaquin Moreno Garijo)')
        self.assertEqual(event_object.desc, expected_description)

        event_object = events[2]
        expected_description = (u'Last validation Apple account '
                                u'[email protected] (Joaquin Moreno Garijo)')
        self.assertEqual(event_object.desc, expected_description)
Пример #4
0
 def setUp(self):
   """Sets up the needed objects used throughout the test."""
   self._plugin = appleaccount.AppleAccountPlugin()
   self._parser = plist.PlistParser()
Пример #5
0
 def setUp(self):
     """Sets up the needed objects used throughout the test."""
     self._plugin = appleaccount.AppleAccountPlugin(None)
     self._parser = plist.PlistParser(event.PreprocessObject(), None)
Пример #6
0
 def setUp(self):
   """Makes preparations before running an individual test."""
   self._plugin = appleaccount.AppleAccountPlugin()
   self._parser = plist.PlistParser()