| 1234567891011121314151617181920212223242526272829303132 | import pwman.util.config as configimport osfrom pwman.util.crypto import (CryptoEngine, CryptoException,                               CryptoNoCallbackException)# set cls_timout to negative number (e.g. -1) to disabledefault_config = {'Global': {'umask': '0100', 'colors': 'yes',                             'cls_timeout': '5'                             },                  'Database': {'type': 'SQLite',                               'filename': os.path.join("tests", "pwman.db")},                  'Encryption': {'algorithm': 'AES'},                  'Readline': {'history': os.path.join("tests",                                                       "history")}                  }config.set_defaults(default_config)import unittestclass CryptoTest(unittest.TestCase):    def test_no_algorithm(self):        config.set_value('Encryption', 'algorithm', '')        self.assertRaises((CryptoException,), CryptoEngine)    def test_getcipher(self):        crypto = CryptoEngine()        self.assertRaises((CryptoNoCallbackException,), crypto._getcipher)    def test_prepare_data(self):        obj = 'dummy_data'        self.assertTrue(True)
 |