aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJon Wayne Parrott <jonwayne@google.com>2016-07-27 14:17:39 -0700
committerJon Wayne Parrott <jonwayne@google.com>2016-07-27 14:54:17 -0700
commite9bcd2d9d779c462386f523ecc6419477d6fed2c (patch)
tree059f69672be47200d197ff0c7322e339b91193b0 /tests
parentbb2386ea51b330765b7c44461465bdceb0be09b4 (diff)
downloadoauth2client-e9bcd2d9d779c462386f523ecc6419477d6fed2c.tar.gz
Add warnings and helpers for prompt='consent'.
Diffstat (limited to 'tests')
-rw-r--r--tests/contrib/test_appengine.py8
-rw-r--r--tests/test_client.py14
2 files changed, 18 insertions, 4 deletions
diff --git a/tests/contrib/test_appengine.py b/tests/contrib/test_appengine.py
index af544e3..cdaf6c5 100644
--- a/tests/contrib/test_appengine.py
+++ b/tests/contrib/test_appengine.py
@@ -840,7 +840,7 @@ class DecoratorTests(unittest2.TestCase):
decorator = appengine.OAuth2Decorator(
client_id='foo_client_id', client_secret='foo_client_secret',
user_agent='foo_user_agent', scope=['foo_scope', 'bar_scope'],
- access_type='offline', approval_prompt='force',
+ access_type='offline', prompt='consent',
revoke_uri='dummy_revoke_uri')
request_handler = MockRequestHandler()
decorator._create_flow(request_handler)
@@ -848,7 +848,7 @@ class DecoratorTests(unittest2.TestCase):
self.assertEqual('https://example.org/oauth2callback',
decorator.flow.redirect_uri)
self.assertEqual('offline', decorator.flow.params['access_type'])
- self.assertEqual('force', decorator.flow.params['approval_prompt'])
+ self.assertEqual('consent', decorator.flow.params['prompt'])
self.assertEqual('foo_user_agent', decorator.flow.user_agent)
self.assertEqual('dummy_revoke_uri', decorator.flow.revoke_uri)
self.assertEqual(None, decorator.flow.params.get('user_agent', None))
@@ -911,8 +911,8 @@ class DecoratorTests(unittest2.TestCase):
decorator = appengine.OAuth2DecoratorFromClientSecrets(
datafile('client_secrets.json'),
scope=['foo_scope', 'bar_scope'],
- approval_prompt='force')
- self.assertTrue('approval_prompt' in decorator._kwargs)
+ prompt='consent')
+ self.assertIn('prompt', decorator._kwargs)
def test_decorator_from_cached_client_secrets(self):
cache_mock = CacheMock()
diff --git a/tests/test_client.py b/tests/test_client.py
index 5af0422..ba69476 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -1679,6 +1679,20 @@ class OAuth2WebServerFlowTest(unittest2.TestCase):
self.assertEqual(client.OOB_CALLBACK_URN, q['redirect_uri'][0])
self.assertEqual('online', q['access_type'][0])
+ def test__oauth2_web_server_flow_params(self):
+ params = client._oauth2_web_server_flow_params({})
+ self.assertEqual(params['access_type'], 'offline')
+ self.assertEqual(params['response_type'], 'code')
+
+ params = client._oauth2_web_server_flow_params({
+ 'approval_prompt': 'force'})
+ self.assertEqual(params['prompt'], 'consent')
+ self.assertNotIn('approval_prompt', params)
+
+ params = client._oauth2_web_server_flow_params({
+ 'approval_prompt': 'other'})
+ self.assertEqual(params['approval_prompt'], 'other')
+
@mock.patch('oauth2client.client.logger')
def test_step1_get_authorize_url_redirect_override(self, logger):
flow = client.OAuth2WebServerFlow('client_id+1', scope='foo',