def testProcess(self): """Tests the Process function.""" plist_name = u'com.apple.airport.preferences.plist' plugin = airport.AirportPlugin() storage_writer = self._ParsePlistFileWithPlugin( plugin, [plist_name], plist_name) self.assertEqual(storage_writer.number_of_events, 4) # The order in which PlistParser generates events is nondeterministic # hence we sort the events. events = list(storage_writer.GetSortedEvents()) expected_timestamps = [ 1375144166000000, 1386874984000000, 1386949546000000, 1386950747000000 ] timestamps = sorted([event.timestamp for event in events]) self.assertEqual(timestamps, expected_timestamps) event = events[0] self.assertEqual(event.key, u'item') self.assertEqual(event.root, u'/RememberedNetworks') expecte_description = ( u'[WiFi] Connected to network: <europa> using security ' u'WPA/WPA2 Personal') self.assertEqual(event.desc, expecte_description) expected_message = u'/RememberedNetworks/item {0:s}'.format( expecte_description) expected_short_message = u'{0:s}...'.format(expected_message[:77]) self._TestGetMessageStrings(event, expected_message, expected_short_message)
def testProcess(self): """Tests the Process function.""" plist_name = 'com.apple.airport.preferences.plist' plugin = airport.AirportPlugin() storage_writer = self._ParsePlistFileWithPlugin( plugin, [plist_name], plist_name) self.assertEqual(storage_writer.number_of_warnings, 0) self.assertEqual(storage_writer.number_of_events, 4) # The order in which PlistParser generates events is nondeterministic # hence we sort the events. events = list(storage_writer.GetSortedEvents()) expected_timestamps = [ 1375144166000000, 1386874984000000, 1386949546000000, 1386950747000000 ] timestamps = sorted([event.timestamp for event in events]) self.assertEqual(timestamps, expected_timestamps) expected_event_values = { 'data_type': 'plist:key', 'desc': ('[WiFi] Connected to network: <europa> using security ' 'WPA/WPA2 Personal'), 'key': 'item', 'root': '/RememberedNetworks' } self.CheckEventValues(storage_writer, events[0], expected_event_values)
def setUp(self): """Sets up the needed objects used throughout the test.""" self._plugin = airport.AirportPlugin() self._parser = plist.PlistParser()
def setUp(self): """Makes preparations before running an individual test.""" self._plugin = airport.AirportPlugin() self._parser = plist.PlistParser()
def setUp(self): """Sets up the needed objects used throughout the test.""" self._plugin = airport.AirportPlugin(None) self._parser = plist.PlistParser(event.PreprocessObject(), None)