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