Exemple #1
0
 def testPercent(self):
     self.mock_pwd_file()
     pwd = 'abc%%def'
     self.assertEqual(
         Password.decrypt(Password.encrypt(pwd)),
         pwd)
Exemple #2
0
 def testBackslash(self):
     self.mock_pwd_file()
     pwd = 'abc\\def'
     self.assertEqual(
         Password.decrypt(Password.encrypt(pwd)),
         pwd)
Exemple #3
0
 def testBoth(self):
     self.mock_pwd_file()
     pwd = "Test password"
     encrypted = Password.encrypt(pwd)
     self.assertEqual(pwd, Password.decrypt(encrypted))
Exemple #4
0
 def testCryptedPasswordWithoutKey(self):
     Password.KEYFILE = "/some/nonexistant/file"
     # passwd = "TestSecretPassword!"
     with self.assertRaises(InvalidKeyFile):
         Password.decrypt(unhexlify("06a9214036b8a15b512e03d534120006"))
Exemple #5
0
 def testCryptedPasswordWithoutKey(self):
     Password.KEYFILE = "/some/nonexistant/file"
     # passwd = "TestSecretPassword!"
     with self.assertRaises(InvalidKeyFile):
         Password.decrypt(unhexlify("06a9214036b8a15b512e03d534120006"))
Exemple #6
0
 def test_unicode(self):
     self.mock_pwd_file()
     pwd = u'‣'
     self.assertEqual(Password.decrypt(Password.encrypt(pwd)), pwd)
Exemple #7
0
 def test_unicode(self):
     self.mock_pwd_file()
     pwd = u'‣'
     self.assertEqual(Password.decrypt(Password.encrypt(pwd)), pwd)