diff options
| author | Hiroki KIYOHARA <hirokiky@gmail.com> | 2015-09-29 11:35:39 +0900 |
|---|---|---|
| committer | Hiroki KIYOHARA <hirokiky@gmail.com> | 2015-09-29 11:35:39 +0900 |
| commit | 37bea19049497c820891c2ccbcce9c4b9dc0d7b9 (patch) | |
| tree | b9596eb85b1373e238488df0c065a226282b5289 /tests | |
| parent | 79722b2aa0b191db4a345ce29095b70d92ded140 (diff) | |
| download | oauthlib-37bea19049497c820891c2ccbcce9c4b9dc0d7b9.tar.gz | |
Added tests auth grant without refresh token
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/oauth2/rfc6749/grant_types/test_authorization_code.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/oauth2/rfc6749/grant_types/test_authorization_code.py b/tests/oauth2/rfc6749/grant_types/test_authorization_code.py index 61e63e2..e206b91 100644 --- a/tests/oauth2/rfc6749/grant_types/test_authorization_code.py +++ b/tests/oauth2/rfc6749/grant_types/test_authorization_code.py @@ -70,6 +70,23 @@ class AuthorizationCodeGrantTest(TestCase): self.assertTrue(self.mock_validator.validate_grant_type.called) self.assertTrue(self.mock_validator.invalidate_authorization_code.called) + def test_create_token_response_without_refresh_token(self): + self.auth.refresh_token = False # Not to issue refresh token. + + bearer = BearerToken(self.mock_validator) + h, token, s = self.auth.create_token_response(self.request, bearer) + token = json.loads(token) + self.assertIn('access_token', token) + self.assertNotIn('refresh_token', token) + self.assertIn('expires_in', token) + self.assertIn('scope', token) + self.assertTrue(self.mock_validator.client_authentication_required.called) + self.assertTrue(self.mock_validator.authenticate_client.called) + self.assertTrue(self.mock_validator.validate_code.called) + self.assertTrue(self.mock_validator.confirm_redirect_uri.called) + self.assertTrue(self.mock_validator.validate_grant_type.called) + self.assertTrue(self.mock_validator.invalidate_authorization_code.called) + def test_invalid_request(self): del self.request.code self.assertRaises(errors.InvalidRequestError, self.auth.validate_token_request, |
