summaryrefslogtreecommitdiff
path: root/tests/oauth2/rfc6749/test_parameters.py
diff options
context:
space:
mode:
authorJoseph Tate <joseph@crunch.io>2015-02-27 02:06:02 -0500
committerJoseph Tate <joseph@crunch.io>2015-04-13 04:35:06 -0400
commit281e2773b18051b0091a62780c0387a98c99660a (patch)
treeedc0917889a2387a8dfe685affb4cd0665764839 /tests/oauth2/rfc6749/test_parameters.py
parente1eee129c074d0de411122d6e1f34a3533952615 (diff)
downloadoauthlib-281e2773b18051b0091a62780c0387a98c99660a.tar.gz
add failing test
Diffstat (limited to 'tests/oauth2/rfc6749/test_parameters.py')
-rw-r--r--tests/oauth2/rfc6749/test_parameters.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/oauth2/rfc6749/test_parameters.py b/tests/oauth2/rfc6749/test_parameters.py
index 6b14115..a7de41a 100644
--- a/tests/oauth2/rfc6749/test_parameters.py
+++ b/tests/oauth2/rfc6749/test_parameters.py
@@ -95,6 +95,11 @@ class ParameterTests(TestCase):
' "refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA",'
' "example_parameter": "example_value",'
' "scope":"abc def"}')
+ json_response_noscope = ('{ "access_token": "2YotnFZFEjr1zCsicMWpAA",'
+ ' "token_type": "example",'
+ ' "expires_in": 3600,'
+ ' "refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA",'
+ ' "example_parameter": "example_value" }')
json_error = '{ "error": "invalid_request" }'
@@ -125,6 +130,15 @@ class ParameterTests(TestCase):
'scope': ['abc', 'def']
}
+ json_noscope_dict = {
+ 'access_token': '2YotnFZFEjr1zCsicMWpAA',
+ 'token_type': 'example',
+ 'expires_in': 3600,
+ 'expires_at': 4600,
+ 'refresh_token': 'tGzv3JOkF0XG5Qx2TlKWIA',
+ 'example_parameter': 'example_value'
+ }
+
json_notype_dict = {
'access_token': '2YotnFZFEjr1zCsicMWpAA',
'expires_in': 3600,
@@ -194,6 +208,9 @@ class ParameterTests(TestCase):
self.assertRaises(InvalidRequestError, parse_token_response, self.json_error)
self.assertRaises(MissingTokenError, parse_token_response, self.json_notoken)
+ self.assertEqual(parse_token_response(self.json_response_noscope,
+ scope=['all', 'the', 'scopes']), self.json_noscope_dict)
+
scope_changes_recorded = []
def record_scope_change(sender, message, old, new):
scope_changes_recorded.append((message, old, new))
@@ -212,6 +229,7 @@ class ParameterTests(TestCase):
signals.scope_changed.disconnect(record_scope_change)
del os.environ['OAUTHLIB_RELAX_TOKEN_SCOPE']
+
def test_json_token_notype(self):
"""Verify strict token type parsing only when configured. """
self.assertEqual(parse_token_response(self.json_notype), self.json_notype_dict)