diff options
Diffstat (limited to 'distixapi/authn_tests.py')
-rw-r--r-- | distixapi/authn_tests.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/distixapi/authn_tests.py b/distixapi/authn_tests.py index 063b400..329eac6 100644 --- a/distixapi/authn_tests.py +++ b/distixapi/authn_tests.py @@ -40,6 +40,23 @@ class GetCredentialsTests(unittest.TestCase): self.assertEqual(password, p) +class EncryptPasswordTests(unittest.TestCase): + + def test_returns_value_not_containing_cleartext_password(self): + cleartext = 'secret' + salt = 'salt' + encrypted = distixapi.encrypt_password(salt, cleartext) + self.assertFalse(cleartext in encrypted) + + def test_returns_different_values_with_different_salt(self): + cleartext = 'secret' + salt_1 = 'salt' + salt_2 = 'salt2' + encrypted_1 = distixapi.encrypt_password(salt_1, cleartext) + encrypted_2 = distixapi.encrypt_password(salt_2, cleartext) + self.assertNotEqual(encrypted_1, encrypted_2) + + class DummyRequest(object): def __init__(self): |