diff options
author | Brendan McCollam <bmccollam@uchicago.edu> | 2016-11-21 14:47:59 +0000 |
---|---|---|
committer | Brendan McCollam <bmccollam@uchicago.edu> | 2016-12-22 15:00:32 +0000 |
commit | 41f853f9d56bfb403b40f00054a56242e1be52ed (patch) | |
tree | 8042ad59c95b9a0eb514c698ed88945098831e8c /tests/oauth2/rfc6749/grant_types/test_refresh_token.py | |
parent | 28cf20b3ad64b568bff8507ea68a231651bd132e (diff) | |
download | oauthlib-41f853f9d56bfb403b40f00054a56242e1be52ed.tar.gz |
Adds tests for custom grant validators
Diffstat (limited to 'tests/oauth2/rfc6749/grant_types/test_refresh_token.py')
-rw-r--r-- | tests/oauth2/rfc6749/grant_types/test_refresh_token.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/oauth2/rfc6749/grant_types/test_refresh_token.py b/tests/oauth2/rfc6749/grant_types/test_refresh_token.py index 125dc2b..99e05d6 100644 --- a/tests/oauth2/rfc6749/grant_types/test_refresh_token.py +++ b/tests/oauth2/rfc6749/grant_types/test_refresh_token.py @@ -36,6 +36,21 @@ class RefreshTokenGrantTest(TestCase): self.assertIn('expires_in', token) self.assertEqual(token['scope'], 'foo') + def test_custom_token_validators(self): + self.authval1, self.authval2 = mock.Mock(), mock.Mock() + self.tknval1, self.tknval2 = mock.Mock(), mock.Mock() + self.auth.register_token_validator(self.tknval1, after_standard=False) + self.auth.register_token_validator(self.tknval2, after_standard=True) + self.auth.register_authorization_validator(self.authval1, after_standard=False) + self.auth.register_authorization_validator(self.authval2, after_standard=True) + + bearer = BearerToken(self.mock_validator) + self.auth.create_token_response(self.request, bearer) + self.assertTrue(self.tknval1.called) + self.assertTrue(self.tknval2.called) + self.assertFalse(self.authval1.called) + self.assertFalse(self.authval2.called) + def test_create_token_inherit_scope(self): self.request.scope = None self.mock_validator.get_original_scopes.return_value = ['foo', 'bar'] |