62
62
from oauth2client .appengine import FlowNDBProperty
63
63
from oauth2client .appengine import FlowProperty
64
64
from oauth2client .appengine import OAuth2Decorator
65
+ from oauth2client .appengine import OAuth2DecoratorFromClientSecrets
65
66
from oauth2client .appengine import StorageByKeyName
66
- from oauth2client .appengine import oauth2decorator_from_clientsecrets
67
67
from oauth2client .client import AccessTokenRefreshError
68
68
from oauth2client .client import Credentials
69
69
from oauth2client .client import FlowExchangeError
@@ -748,7 +748,7 @@ def test_token_response_param(self):
748
748
self .test_required ()
749
749
750
750
def test_decorator_from_client_secrets (self ):
751
- decorator = oauth2decorator_from_clientsecrets (
751
+ decorator = OAuth2DecoratorFromClientSecrets (
752
752
datafile ('client_secrets.json' ),
753
753
scope = ['foo_scope' , 'bar_scope' ])
754
754
self ._finish_setup (decorator , user_mock = UserMock )
@@ -765,16 +765,24 @@ def test_decorator_from_client_secrets(self):
765
765
self .assertEqual (self .decorator ._revoke_uri ,
766
766
self .decorator .credentials .revoke_uri )
767
767
768
+ def test_decorator_from_client_secrets_kwargs (self ):
769
+ decorator = OAuth2DecoratorFromClientSecrets (
770
+ datafile ('client_secrets.json' ),
771
+ scope = ['foo_scope' , 'bar_scope' ],
772
+ approval_prompt = 'force' )
773
+ self .assertTrue ('approval_prompt' in decorator ._kwargs )
774
+
775
+
768
776
def test_decorator_from_cached_client_secrets (self ):
769
777
cache_mock = CacheMock ()
770
778
load_and_cache ('client_secrets.json' , 'secret' , cache_mock )
771
- decorator = oauth2decorator_from_clientsecrets (
779
+ decorator = OAuth2DecoratorFromClientSecrets (
772
780
# filename, scope, message=None, cache=None
773
781
'secret' , '' , cache = cache_mock )
774
782
self .assertFalse (decorator ._in_error )
775
783
776
784
def test_decorator_from_client_secrets_not_logged_in_required (self ):
777
- decorator = oauth2decorator_from_clientsecrets (
785
+ decorator = OAuth2DecoratorFromClientSecrets (
778
786
datafile ('client_secrets.json' ),
779
787
scope = ['foo_scope' , 'bar_scope' ], message = 'NotLoggedInMessage' )
780
788
self .decorator = decorator
@@ -789,7 +797,7 @@ def test_decorator_from_client_secrets_not_logged_in_required(self):
789
797
self .assertTrue ('Login' in str (response ))
790
798
791
799
def test_decorator_from_client_secrets_not_logged_in_aware (self ):
792
- decorator = oauth2decorator_from_clientsecrets (
800
+ decorator = OAuth2DecoratorFromClientSecrets (
793
801
datafile ('client_secrets.json' ),
794
802
scope = ['foo_scope' , 'bar_scope' ], message = 'NotLoggedInMessage' )
795
803
self .decorator = decorator
@@ -804,7 +812,7 @@ def test_decorator_from_client_secrets_not_logged_in_aware(self):
804
812
def test_decorator_from_unfilled_client_secrets_required (self ):
805
813
MESSAGE = 'File is missing'
806
814
try :
807
- decorator = oauth2decorator_from_clientsecrets (
815
+ decorator = OAuth2DecoratorFromClientSecrets (
808
816
datafile ('unfilled_client_secrets.json' ),
809
817
scope = ['foo_scope' , 'bar_scope' ], message = MESSAGE )
810
818
except InvalidClientSecretsError :
@@ -813,7 +821,7 @@ def test_decorator_from_unfilled_client_secrets_required(self):
813
821
def test_decorator_from_unfilled_client_secrets_aware (self ):
814
822
MESSAGE = 'File is missing'
815
823
try :
816
- decorator = oauth2decorator_from_clientsecrets (
824
+ decorator = OAuth2DecoratorFromClientSecrets (
817
825
datafile ('unfilled_client_secrets.json' ),
818
826
scope = ['foo_scope' , 'bar_scope' ], message = MESSAGE )
819
827
except InvalidClientSecretsError :
0 commit comments