Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cenkalti committed Oct 2, 2014
1 parent 372a8d7 commit 038be00
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test_flask_github.py
Expand Up @@ -7,6 +7,8 @@
from flask import Flask, request, redirect
from flask_github import GitHub

logger = logging.getLogger(__name__)


class GitHubTestCase(unittest.TestCase):

Expand Down Expand Up @@ -34,9 +36,9 @@ def assert_params(*args, **kwargs):

@app.route('/login')
def login():
return github.authorize()
return github.authorize(redirect_uri="http://localhost/callback")

@app.route('/github-callback')
@app.route('/callback')
@github.authorized_handler
def authorized(token):
access_token.append(token)
Expand All @@ -46,9 +48,12 @@ def authorized(token):
# http://developer.github.com/v3/oauth/#web-application-flow
@app.route('/oauth/authorize')
def handle_auth():
logger.info("in /oauth/authorize")
called_auth.append(1)
assert request.args['client_id'] == '123'
assert request.args['redirect_uri'] == 'http://localhost/github-callback'
logger.debug("client_id OK")
assert request.args['redirect_uri'] == 'http://localhost/callback'
logger.debug("redirect_uri OK")
return redirect(request.args['redirect_uri'] + '?code=KODE')

access_token = []
Expand All @@ -58,7 +63,7 @@ def handle_auth():
client.get('/login', follow_redirects=True)

assert called_auth
assert access_token == ['asdf']
assert access_token == ['asdf'], access_token


if __name__ == '__main__':
Expand Down

0 comments on commit 038be00

Please sign in to comment.