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.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/distixapi/authn_tests.py b/distixapi/authn_tests.py
index 7a150b5..2d3720a 100644
--- a/distixapi/authn_tests.py
+++ b/distixapi/authn_tests.py
@@ -87,6 +87,26 @@ class PasswordCheckingTests(unittest.TestCase):
with self.assertRaises(distixapi.AuthenticationError):
distixapi.get_scopes(users, request)
+ def test_returns_scopes_for_correct_creds(self):
+ username = 'fooser'
+ salt = 'nacl'
+ password = 'passwooooord'
+ scopes = ['get', 'put']
+
+ users = {
+ 'users': {
+ username: {
+ 'salt': salt,
+ 'password': distixapi.encrypt_password(salt, password),
+ 'name': 'J. Random User',
+ 'scopes': scopes,
+ }
+ },
+ }
+
+ request = make_request(username, password)
+ self.assertEqual(distixapi.get_scopes(users, request), scopes)
+
class DummyRequest(object):