Skip to content

Commit 764b83c

Browse files
committed
added test to track oauthlib/oauthlib#339
1 parent bb62289 commit 764b83c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

oauth2_provider/tests/test_token_revocation.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,30 @@ def test_revoke_access_token(self):
6060
self.assertEqual(response.content, b'')
6161
self.assertFalse(AccessToken.objects.filter(id=tok.id).exists())
6262

63+
def test_revoke_access_token_public(self):
64+
public_app = Application(
65+
name="Test Application",
66+
redirect_uris="http://localhost http://example.com http://example.it",
67+
user=self.dev_user,
68+
client_type=Application.CLIENT_PUBLIC,
69+
authorization_grant_type=Application.GRANT_AUTHORIZATION_CODE,
70+
)
71+
public_app.save()
72+
73+
tok = AccessToken.objects.create(user=self.test_user, token='1234567890',
74+
application=public_app,
75+
expires=timezone.now() + datetime.timedelta(days=1),
76+
scope='read write')
77+
78+
query_string = urlencode({
79+
'client_id': public_app.client_id,
80+
'token': tok.token,
81+
})
82+
83+
url = "{url}?{qs}".format(url=reverse('oauth2_provider:revoke-token'), qs=query_string)
84+
response = self.client.post(url)
85+
self.assertEqual(response.status_code, 200)
86+
6387
def test_revoke_access_token_with_hint(self):
6488
"""
6589

0 commit comments

Comments
 (0)