blob: 7cd9c71981a67e185c0a3dac998159b21f7d3764 [file] [log] [blame]
Serhiy Storchaka04c0a402017-10-24 23:35:22 +03001import sys
Brett Cannon2e0f9f32008-03-13 20:47:41 +00002from test import test_support
3import unittest
R. David Murray59beec32009-03-30 19:04:00 +00004
5crypt = test_support.import_module('crypt')
Roger E. Massefab8ab81996-12-20 22:36:52 +00006
Serhiy Storchaka04c0a402017-10-24 23:35:22 +03007if sys.platform.startswith('openbsd'):
8 raise unittest.SkipTest('The only supported method on OpenBSD is Blowfish')
9
Brett Cannon2e0f9f32008-03-13 20:47:41 +000010class CryptTestCase(unittest.TestCase):
11
12 def test_crypt(self):
Serhiy Storchaka04c0a402017-10-24 23:35:22 +030013 cr = crypt.crypt('mypassword', 'ab')
14 if cr is not None:
15 cr2 = crypt.crypt('mypassword', cr)
16 self.assertEqual(cr2, cr)
17
Brett Cannon2e0f9f32008-03-13 20:47:41 +000018
19def test_main():
20 test_support.run_unittest(CryptTestCase)
21
22if __name__ == "__main__":
23 test_main()