Skip to content

Commit 4704727

Browse files
committed
added test to ensure that a refresh token is not issue on client credential
1 parent ed06759 commit 4704727

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

oauth2_provider/tests/test_client_credential.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ def test_client_credential_access_allowed(self):
8181
response = view(request)
8282
self.assertEqual(response, "This is a protected resource")
8383

84+
def test_client_credential_does_not_issue_refresh_token(self):
85+
token_request_data = {
86+
'grant_type': 'client_credentials',
87+
}
88+
auth_headers = self.get_basic_auth_header(self.application.client_id, self.application.client_secret)
89+
90+
response = self.client.post(reverse('oauth2_provider:token'), data=token_request_data, **auth_headers)
91+
self.assertEqual(response.status_code, 200)
92+
93+
content = json.loads(response.content.decode("utf-8"))
94+
self.assertNotIn("refresh_token", content)
95+
8496

8597
class TestExtendedRequest(BaseTest):
8698
@classmethod

0 commit comments

Comments
 (0)