1 import sys 2 from test import test_support 3 import unittest 4 5 crypt = test_support.import_module('crypt') 6 7 if sys.platform.startswith('openbsd'): 8 raise unittest.SkipTest('The only supported method on OpenBSD is Blowfish') 9 10 class CryptTestCase(unittest.TestCase): 11 12 def test_crypt(self): 13 cr = crypt.crypt('mypassword', 'ab') 14 if cr is not None: 15 cr2 = crypt.crypt('mypassword', cr) 16 self.assertEqual(cr2, cr) 17 18 19 def test_main(): 20 test_support.run_unittest(CryptTestCase) 21 22 if __name__ == "__main__": 23 test_main() 24