summaryrefslogtreecommitdiff
path: root/tests/oauth2/rfc6749/test_server.py
diff options
context:
space:
mode:
authorWiliam Souza <wiliamsouza83@gmail.com>2017-10-01 03:07:11 -0300
committerOmer Katz <omer.drow@gmail.com>2017-10-01 09:07:11 +0300
commite575cca3e5d18b1e7051c64f435f2cdea71a29ab (patch)
tree9034c64194268701ad6c5eada0d4b7b07e980279 /tests/oauth2/rfc6749/test_server.py
parent04959fe009cb2622c7422c736456cdbd36ec43b3 (diff)
downloadoauthlib-e575cca3e5d18b1e7051c64f435f2cdea71a29ab.tar.gz
OpenID connect improvements (#484)
* Change create_token_response to only save access_token when it's present in request.response_type * Remove unused import, fix indentation and improve comment * Fix AuthorizationEndpoint response_type for OpenID Connect hybrid flow * Add new ImplicitTokenGrantDispatcher Changes AuthorizationEndpoint response_type `'token'`, `'id_token'` and `'id_token token'` to work with OpenID Connect and OAuth2 implicit flow in a transparent way * Add new AuthTokenGrantDispatcher Change AuthorizationEndpoint grant_types `'authorization_code'` to work with OpenID Connect and OAuth2 authorization flow in a transparent way * Change tests to include required client_id and redirect_uri * Remove AuthorizationEndpoint grant_types `'openid'` Now OpenID Connect and OAuth2 authorization flow can use `authorization_code` in a transparent way * Add sone blank lines and fix indentation * Change AuthorizationEndpoint grant type id_token and id_token token to use openid_connect_implicit direct * Change default empty value to None and fix a typo * Add assert called to AuthTokenGrantDispatcher tests * Add request to get_authorization_code_scopes
Diffstat (limited to 'tests/oauth2/rfc6749/test_server.py')
-rw-r--r--tests/oauth2/rfc6749/test_server.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/oauth2/rfc6749/test_server.py b/tests/oauth2/rfc6749/test_server.py
index 305b795..da303ce 100644
--- a/tests/oauth2/rfc6749/test_server.py
+++ b/tests/oauth2/rfc6749/test_server.py
@@ -279,7 +279,7 @@ twIDAQAB
@mock.patch('oauthlib.common.generate_token', new=lambda: 'abc')
def test_authorization_grant(self):
- body = 'grant_type=authorization_code&code=abc&scope=all+of+them&state=xyz'
+ body = 'client_id=me&redirect_uri=http%3A%2F%2Fback.to%2Fme&grant_type=authorization_code&code=abc&scope=all+of+them&state=xyz'
headers, body, status_code = self.endpoint.create_token_response(
'', body=body)
body = json.loads(body)
@@ -293,7 +293,7 @@ twIDAQAB
}
self.assertEqual(body, token)
- body = 'grant_type=authorization_code&code=abc&state=xyz'
+ body = 'client_id=me&redirect_uri=http%3A%2F%2Fback.to%2Fme&grant_type=authorization_code&code=abc&state=xyz'
headers, body, status_code = self.endpoint.create_token_response(
'', body=body)
body = json.loads(body)
@@ -349,12 +349,12 @@ twIDAQAB
self.assertEqual(body, token)
def test_missing_type(self):
- _, body, _ = self.endpoint.create_token_response('', body='')
+ _, body, _ = self.endpoint.create_token_response('', body='client_id=me&redirect_uri=http%3A%2F%2Fback.to%2Fme&code=abc')
token = {'error': 'unsupported_grant_type'}
self.assertEqual(json.loads(body), token)
def test_invalid_type(self):
- body = 'grant_type=invalid'
+ body = 'client_id=me&redirect_uri=http%3A%2F%2Fback.to%2Fme&grant_type=invalid&code=abc'
_, body, _ = self.endpoint.create_token_response('', body=body)
token = {'error': 'unsupported_grant_type'}
self.assertEqual(json.loads(body), token)