Skip to content

Commit 521c13b

Browse files
committed
Test cases for access token generator. #42
1 parent 14cd2bf commit 521c13b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/oauth2/test_oauth2.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,3 +270,19 @@ class TestCredentialAuthSQLAlchemy(TestCredentialAuth):
270270

271271
def create_oauth_provider(self, app):
272272
return sqlalchemy_provider(app)
273+
274+
275+
class TestTokenGenerator(OAuthSuite):
276+
277+
def create_oauth_provider(self, app):
278+
279+
def generator(request, refresh_token=False):
280+
return 'foobar'
281+
282+
app.config['OAUTH2_PROVIDER_TOKEN_GENERATOR'] = generator
283+
return default_provider(app)
284+
285+
def test_get_access_token(self):
286+
rv = self.client.post(authorize_url, data={'confirm': 'yes'})
287+
rv = self.client.get(clean_url(rv.location))
288+
assert 'foobar' in u(rv.data)

0 commit comments

Comments
 (0)