Example #1
0
    def testProcess(self):
        """Tests the Process function."""
        plugin = appusage.ApplicationUsagePlugin()
        storage_writer = self._ParseDatabaseFileWithPlugin(
            ['application_usage.sqlite'], plugin)

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

        events = list(storage_writer.GetEvents())

        # Check the first event.
        event = events[0]

        self.CheckTimestamp(event.timestamp, '2014-05-07 18:52:02.000000')

        event_data = self._GetEventDataOfEvent(storage_writer, event)
        self.assertEqual(event_data.application, '/Applications/Safari.app')
        self.assertEqual(event_data.app_version, '9537.75.14')
        self.assertEqual(event_data.bundle_id, 'com.apple.Safari')
        self.assertEqual(event_data.count, 1)

        expected_message = ('/Applications/Safari.app v.9537.75.14 '
                            '(bundle: com.apple.Safari). '
                            'Launched: 1 time(s)')

        expected_short_message = '/Applications/Safari.app (1 time(s))'

        self._TestGetMessageStrings(event_data, expected_message,
                                    expected_short_message)
Example #2
0
    def testProcess(self):
        """Tests the Process function."""
        plugin = appusage.ApplicationUsagePlugin()
        storage_writer = self._ParseDatabaseFileWithPlugin(
            ['application_usage.sqlite'], plugin)

        # The sqlite database contains 5 events.
        self.assertEqual(storage_writer.number_of_events, 5)

        events = list(storage_writer.GetEvents())

        # Check the first event.
        event = events[0]

        expected_timestamp = timelib.Timestamp.CopyFromString(
            '2014-05-07 18:52:02')
        self.assertEqual(event.timestamp, expected_timestamp)

        self.assertEqual(event.application, '/Applications/Safari.app')
        self.assertEqual(event.app_version, '9537.75.14')
        self.assertEqual(event.bundle_id, 'com.apple.Safari')
        self.assertEqual(event.count, 1)

        expected_message = ('/Applications/Safari.app v.9537.75.14 '
                            '(bundle: com.apple.Safari). '
                            'Launched: 1 time(s)')

        expected_short_message = '/Applications/Safari.app (1 time(s))'

        self._TestGetMessageStrings(event, expected_message,
                                    expected_short_message)
Example #3
0
  def testProcess(self):
    """Tests the Process function."""
    plugin = appusage.ApplicationUsagePlugin()
    storage_writer = self._ParseDatabaseFileWithPlugin(
        ['application_usage.sqlite'], plugin)

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

    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())

    # Check the first event.
    expected_event_values = {
        'application': '/Applications/Safari.app',
        'app_version': '9537.75.14',
        'bundle_id': 'com.apple.Safari',
        'count': 1,
        'data_type': 'macosx:application_usage',
        'date_time': '2014-05-07 18:52:02'}

    self.CheckEventValues(storage_writer, events[0], expected_event_values)
Example #4
0
 def setUp(self):
   """Sets up the needed objects used throughout the test."""
   self._plugin = appusage.ApplicationUsagePlugin()
Example #5
0
 def setUp(self):
     """Makes preparations before running an individual test."""
     self._plugin = appusage.ApplicationUsagePlugin()
Example #6
0
 def setUp(self):
   """Sets up the needed objects used throughout the test."""
   pre_obj = event.PreprocessObject()
   self._plugin = appusage.ApplicationUsagePlugin(pre_obj)