def testGetMessage(self): """Tests the GetMessage function.""" database_reader = winevt_rc.WinevtResourcesSqlite3DatabaseReader() database_reader.Open(self._database_path) expected_message_string = ( u'Your computer has detected that the IP address {0:s} for the Network ' u'Card with network address {2:s} is already in use on the network. ' u'Your computer will automatically attempt to obtain a different ' u'address.') message_string = database_reader.GetMessage( u'Microsoft-Windows-Dhcp-Client', 0x00000409, 0xb00003ed) self.assertEqual(message_string, expected_message_string) database_reader.Close()
def _GetWinevtRcDatabaseReader(self): """Opens the Windows Event Log resource database reader. Returns: The Windows Event Log resource database reader (instance of WinevtResourcesSqlite3DatabaseReader) or None. """ if not self._winevt_database_reader and self._data_location: database_path = os.path.join( self._data_location, self._WINEVT_RC_DATABASE) if not os.path.isfile(database_path): return self._winevt_database_reader = ( winevt_rc.WinevtResourcesSqlite3DatabaseReader()) self._winevt_database_reader.Open(database_path) return self._winevt_database_reader