summaryrefslogtreecommitdiff
path: root/distixapi/authn_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'distixapi/authn_tests.py')
-rw-r--r--distixapi/authn_tests.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/distixapi/authn_tests.py b/distixapi/authn_tests.py
index f9e2e15..7a150b5 100644
--- a/distixapi/authn_tests.py
+++ b/distixapi/authn_tests.py
@@ -65,6 +65,28 @@ class PasswordCheckingTests(unittest.TestCase):
with self.assertRaises(distixapi.AuthenticationError):
distixapi.get_scopes(users, request)
+ def test_raises_exception_if_password_is_wrong(self):
+ username = 'fooser'
+ salt = 'nacl'
+ password = 'passwooooord'
+ wrong_password = password + 'foo'
+ scopes = ['get', 'put']
+
+ users = {
+ 'users': {
+ username: {
+ 'salt': salt,
+ 'password': distixapi.encrypt_password(salt, password),
+ 'name': 'J. Random User',
+ 'scopes': scopes,
+ }
+ },
+ }
+
+ request = make_request(username, wrong_password)
+ with self.assertRaises(distixapi.AuthenticationError):
+ distixapi.get_scopes(users, request)
+
class DummyRequest(object):