def testProcess(self): """Tests the Process function.""" plist_name = 'com.apple.SoftwareUpdate.plist' plugin = softwareupdate.SoftwareUpdatePlugin() 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()) event = events[0] self.assertEqual(event.key, '') self.assertEqual(event.root, '/') expected_description = ( 'Last Mac OS 10.9.1 (13B42) partially ' 'update, pending 1: RAWCameraUpdate5.03(031-2664).') self.assertEqual(event.desc, expected_description) event = events[1] self.assertEqual(event.key, '') self.assertEqual(event.root, '/') expected_description = 'Last MacOS 10.9.1 (13B42) full update.' self.assertEqual(event.desc, expected_description) expected_string = '// {0:s}'.format(expected_description) self._TestGetMessageStrings(event, expected_string, expected_string)
def testProcess(self): """Tests the Process function.""" plist_name = u'com.apple.SoftwareUpdate.plist' plugin_object = softwareupdate.SoftwareUpdatePlugin() storage_writer = self._ParsePlistFileWithPlugin( plugin_object, [plist_name], plist_name) self.assertEqual(len(storage_writer.events), 2) # The order in which PlistParser generates events is nondeterministic # hence we sort the events. events = self._GetSortedEvents(storage_writer.events) event_object = events[0] self.assertEqual(event_object.key, u'') self.assertEqual(event_object.root, u'/') expected_desc = (u'Last Mac OS 10.9.1 (13B42) partially ' u'update, pending 1: RAWCameraUpdate5.03(031-2664).') self.assertEqual(event_object.desc, expected_desc) event_object = events[1] self.assertEqual(event_object.key, u'') self.assertEqual(event_object.root, u'/') expected_desc = u'Last Mac OS X 10.9.1 (13B42) full update.' self.assertEqual(event_object.desc, expected_desc) expected_string = u'// {0:s}'.format(expected_desc) self._TestGetMessageStrings(event_object, expected_string, expected_string)
def testProcess(self): """Tests the Process function.""" plist_name = 'com.apple.SoftwareUpdate.plist' plugin = softwareupdate.SoftwareUpdatePlugin() 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_event_values = { 'data_type': 'plist:key', 'date_time': '2014-01-06 17:43:48.000000', 'desc': ('Last Mac OS 10.9.1 (13B42) partially ' 'update, pending 1: RAWCameraUpdate5.03(031-2664).'), 'key': '', 'root': '/' } self.CheckEventValues(storage_writer, events[1], expected_event_values) expected_event_values = { 'data_type': 'plist:key', 'date_time': '2014-01-06 17:43:48.000000', 'desc': 'Last MacOS 10.9.1 (13B42) full update.', 'key': '', 'root': '/' } self.CheckEventValues(storage_writer, events[0], expected_event_values)
def testProcess(self): """Tests the Process function.""" plist_name = 'com.apple.SoftwareUpdate.plist' plugin = softwareupdate.SoftwareUpdatePlugin() storage_writer = self._ParsePlistFileWithPlugin( plugin, [plist_name], plist_name) self.assertEqual(storage_writer.number_of_warnings, 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_description = ( 'Last Mac OS 10.9.1 (13B42) partially ' 'update, pending 1: RAWCameraUpdate5.03(031-2664).') expected_event_values = { 'desc': expected_description, 'key': '', 'root': '/', 'timestamp': '2014-01-06 17:43:48.000000' } self.CheckEventValues(storage_writer, events[1], expected_event_values) expected_description = 'Last MacOS 10.9.1 (13B42) full update.' expected_event_values = { 'desc': expected_description, 'key': '', 'root': '/', 'timestamp': '2014-01-06 17:43:48.000000' } self.CheckEventValues(storage_writer, events[0], expected_event_values) expected_string = '// {0:s}'.format(expected_description) event_data = self._GetEventDataOfEvent(storage_writer, events[0]) self._TestGetMessageStrings(event_data, expected_string, expected_string)
def setUp(self): """Sets up the needed objects used throughout the test.""" self._plugin = softwareupdate.SoftwareUpdatePlugin(None) self._parser = plist.PlistParser(event.PreprocessObject(), None)
def setUp(self): """Sets up the needed objects used throughout the test.""" self._plugin = softwareupdate.SoftwareUpdatePlugin() self._parser = plist.PlistParser()
def setUp(self): """Makes preparations before running an individual test.""" self._plugin = softwareupdate.SoftwareUpdatePlugin() self._parser = plist.PlistParser()