diff options
author | Ib Lundgren <ib.lundgren@gmail.com> | 2014-09-25 14:33:04 +0100 |
---|---|---|
committer | Ib Lundgren <ib.lundgren@gmail.com> | 2014-09-25 14:33:04 +0100 |
commit | b85f89ac3379ff720acaeca2a79ea5ae6ebba5e9 (patch) | |
tree | dae221b8892c104b640d17f9e394dc3075ea7237 /tests/oauth2/rfc6749/endpoints | |
parent | 2d7dab66b589159712f96bd0086f45ae3c32216d (diff) | |
download | oauthlib-b85f89ac3379ff720acaeca2a79ea5ae6ebba5e9.tar.gz |
Make jsonp support in revocation endpoint optional.
Also include the error in jsonp callback.
Diffstat (limited to 'tests/oauth2/rfc6749/endpoints')
-rw-r--r-- | tests/oauth2/rfc6749/endpoints/test_revocation_endpoint.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/oauth2/rfc6749/endpoints/test_revocation_endpoint.py b/tests/oauth2/rfc6749/endpoints/test_revocation_endpoint.py index 5f7f14f..78d510d 100644 --- a/tests/oauth2/rfc6749/endpoints/test_revocation_endpoint.py +++ b/tests/oauth2/rfc6749/endpoints/test_revocation_endpoint.py @@ -24,7 +24,7 @@ class RevocationEndpointTest(TestCase): } def test_revoke_token(self): - for token_type in ('access_token', 'refresh_token', 'invalid'): + for token_type in ('access_token', 'refresh_token'): body = urlencode([('token', 'foo'), ('token_type_hint', token_type)]) h, b, s = self.endpoint.create_revocation_response(self.uri, @@ -34,17 +34,27 @@ class RevocationEndpointTest(TestCase): self.assertEqual(s, 200) def test_revoke_with_callback(self): + endpoint = RevocationEndpoint(self.validator, enable_jsonp=True) callback = 'package.hello_world' - for token_type in ('access_token', 'refresh_token', 'invalid'): + for token_type in ('access_token', 'refresh_token'): body = urlencode([('token', 'foo'), ('token_type_hint', token_type), ('callback', callback)]) - h, b, s = self.endpoint.create_revocation_response(self.uri, + h, b, s = endpoint.create_revocation_response(self.uri, headers=self.headers, body=body) self.assertEqual(h, {}) - self.assertEqual(b, callback + '()') + self.assertEqual(b, callback + '();') self.assertEqual(s, 200) + body = urlencode([('token', 'foo'), + ('token_type_hint', 'invalid'), + ('callback', callback)]) + h, b, s = endpoint.create_revocation_response(self.uri, + headers=self.headers, body=body) + self.assertEqual(h, {}) + self.assertEqual(b, callback + '({"error": "unsupported_token_type"});') + self.assertEqual(s, 400) + def test_revoke_unsupported_token(self): endpoint = RevocationEndpoint(self.validator, supported_token_types=['access_token']) |