@@ -40,7 +40,7 @@ def _callFUT(self, *args, **kwargs):
4040 return generate_signed_url (* args , ** kwargs )
4141
4242 def _generate_helper (self , response_type = None , response_disposition = None ,
43- generation = None , credentials = None ):
43+ generation = None ):
4444 import base64
4545 from six .moves .urllib .parse import parse_qs
4646 from six .moves .urllib .parse import urlsplit
@@ -50,7 +50,7 @@ def _generate_helper(self, response_type=None, response_disposition=None,
5050 ENDPOINT = 'http://api.example.com'
5151 RESOURCE = '/name/path'
5252 SIGNED = base64 .b64encode (b'DEADBEEF' )
53- CREDENTIALS = credentials or _Credentials ()
53+ CREDENTIALS = _Credentials ()
5454
5555 def _get_signed_query_params (* args ):
5656 credentials , expiration = args [:2 ]
@@ -90,19 +90,27 @@ def _get_signed_query_params(*args):
9090 self .assertEqual (frag , '' )
9191
9292 def test_w_expiration_int (self ):
93- self ._generate_helper (credentials = _Credentials ())
94-
95- def test_w_google_credentials (self ):
96- self ._generate_helper (credentials = _GoogleCredentials ())
93+ self ._generate_helper ()
9794
9895 def test_w_custom_fields (self ):
9996 response_type = 'text/plain'
10097 response_disposition = 'attachment; filename=blob.png'
10198 generation = '123'
10299 self ._generate_helper (response_type = response_type ,
103100 response_disposition = response_disposition ,
104- generation = generation ,
105- credentials = _Credentials ())
101+ generation = generation )
102+
103+
104+ class Test_generate_signed_url_exception (unittest2 .TestCase ):
105+ def test_with_google_credentials (self ):
106+ import time
107+ from gcloud .credentials import generate_signed_url
108+ RESOURCE = '/name/path'
109+
110+ credentials = _GoogleCredentials ()
111+ expiration = int (time .time () + 5 )
112+ self .assertRaises (AttributeError , generate_signed_url , credentials ,
113+ resource = RESOURCE , expiration = expiration )
106114
107115
108116class Test__get_signed_query_params (unittest2 .TestCase ):
@@ -114,8 +122,6 @@ def _callFUT(self, credentials, expiration, string_to_sign):
114122
115123 def test_it (self ):
116124 import base64
117- # from gcloud._testing import _Monkey
118- # from gcloud import credentials as MUT
119125
120126 SIG_BYTES = b'DEADBEEF'
121127 ACCOUNT_NAME = object ()
0 commit comments