@@ -40,7 +40,7 @@ def _callFUT(self, *args, **kwargs):
40
40
return generate_signed_url (* args , ** kwargs )
41
41
42
42
def _generate_helper (self , response_type = None , response_disposition = None ,
43
- generation = None ):
43
+ generation = None , credentials = None ):
44
44
import base64
45
45
from six .moves .urllib .parse import parse_qs
46
46
from six .moves .urllib .parse import urlsplit
@@ -50,7 +50,7 @@ def _generate_helper(self, response_type=None, response_disposition=None,
50
50
ENDPOINT = 'http://api.example.com'
51
51
RESOURCE = '/name/path'
52
52
SIGNED = base64 .b64encode (b'DEADBEEF' )
53
- CREDENTIALS = _Credentials ()
53
+ CREDENTIALS = credentials or _Credentials ()
54
54
55
55
def _get_signed_query_params (* args ):
56
56
credentials , expiration = args [:2 ]
@@ -90,15 +90,19 @@ def _get_signed_query_params(*args):
90
90
self .assertEqual (frag , '' )
91
91
92
92
def test_w_expiration_int (self ):
93
- self ._generate_helper ()
93
+ self ._generate_helper (credentials = _Credentials ())
94
+
95
+ def test_w_google_credentials (self ):
96
+ self ._generate_helper (credentials = _GoogleCredentials ())
94
97
95
98
def test_w_custom_fields (self ):
96
99
response_type = 'text/plain'
97
100
response_disposition = 'attachment; filename=blob.png'
98
101
generation = '123'
99
102
self ._generate_helper (response_type = response_type ,
100
103
response_disposition = response_disposition ,
101
- generation = generation )
104
+ generation = generation ,
105
+ credentials = _Credentials ())
102
106
103
107
104
108
class Test__get_signed_query_params (unittest2 .TestCase ):
@@ -226,6 +230,12 @@ def sign_blob(self, bytes_to_sign):
226
230
return None , self ._sign_result
227
231
228
232
233
+ class _GoogleCredentials (object ):
234
+
235
+ def __init__ (self , service_account_email = 'testing@example.com' ):
236
+ self .service_account_email = service_account_email
237
+
238
+
229
239
class _Client (object ):
230
240
231
241
def __init__ (self ):
0 commit comments