@@ -191,7 +191,9 @@ def test_download_to_file(self):
191191 (chunk2_response , 'def' ),
192192 )
193193 bucket = _Bucket (connection )
194- key = self ._makeOne (bucket , KEY )
194+ MEDIA_LINK = 'http://example.com/media/'
195+ properties = {'mediaLink' : MEDIA_LINK }
196+ key = self ._makeOne (bucket , KEY , properties )
195197 key .CHUNK_SIZE = 3
196198 fh = StringIO ()
197199 key .download_to_file (fh )
@@ -210,7 +212,9 @@ def test_download_to_filename(self):
210212 (chunk2_response , 'def' ),
211213 )
212214 bucket = _Bucket (connection )
213- key = self ._makeOne (bucket , KEY )
215+ MEDIA_LINK = 'http://example.com/media/'
216+ properties = {'mediaLink' : MEDIA_LINK }
217+ key = self ._makeOne (bucket , KEY , properties )
214218 key .CHUNK_SIZE = 3
215219 with NamedTemporaryFile () as f :
216220 key .download_to_filename (f .name )
@@ -231,7 +235,9 @@ def test_download_as_string(self):
231235 (chunk2_response , 'def' ),
232236 )
233237 bucket = _Bucket (connection )
234- key = self ._makeOne (bucket , KEY )
238+ MEDIA_LINK = 'http://example.com/media/'
239+ properties = {'mediaLink' : MEDIA_LINK }
240+ key = self ._makeOne (bucket , KEY , properties )
235241 key .CHUNK_SIZE = 3
236242 fetched = key .download_as_string ()
237243 self .assertEqual (fetched , 'abcdef' )
@@ -261,7 +267,7 @@ def test_upload_from_file_simple(self):
261267 scheme , netloc , path , qs , _ = urlsplit (uri )
262268 self .assertEqual (scheme , 'http' )
263269 self .assertEqual (netloc , 'example.com' )
264- self .assertEqual (path , '/upload/storage/v1/ b/name/o' )
270+ self .assertEqual (path , '/b/name/o' )
265271 self .assertEqual (dict (parse_qsl (qs )),
266272 {'uploadType' : 'media' , 'name' : 'key' })
267273 headers = dict (
@@ -305,7 +311,7 @@ def test_upload_from_file_resumable(self):
305311 scheme , netloc , path , qs , _ = urlsplit (uri )
306312 self .assertEqual (scheme , 'http' )
307313 self .assertEqual (netloc , 'example.com' )
308- self .assertEqual (path , '/resumable/upload/storage/v1/ b/name/o' )
314+ self .assertEqual (path , '/b/name/o' )
309315 self .assertEqual (dict (parse_qsl (qs )),
310316 {'uploadType' : 'resumable' , 'name' : 'key' })
311317 headers = dict (
@@ -360,7 +366,7 @@ def test_upload_from_file_w_slash_in_name(self):
360366 scheme , netloc , path , qs , _ = urlsplit (uri )
361367 self .assertEqual (scheme , 'http' )
362368 self .assertEqual (netloc , 'example.com' )
363- self .assertEqual (path , '/upload/storage/v1/ b/name/o' )
369+ self .assertEqual (path , '/b/name/o' )
364370 self .assertEqual (dict (parse_qsl (qs )),
365371 {'uploadType' : 'media' , 'name' : 'parent/child' })
366372 headers = dict (
@@ -400,7 +406,7 @@ def test_upload_from_filename(self):
400406 scheme , netloc , path , qs , _ = urlsplit (uri )
401407 self .assertEqual (scheme , 'http' )
402408 self .assertEqual (netloc , 'example.com' )
403- self .assertEqual (path , '/upload/storage/v1/ b/name/o' )
409+ self .assertEqual (path , '/b/name/o' )
404410 self .assertEqual (dict (parse_qsl (qs )),
405411 {'uploadType' : 'media' , 'name' : 'key' })
406412 headers = dict (
@@ -436,7 +442,7 @@ def test_upload_from_string(self):
436442 scheme , netloc , path , qs , _ = urlsplit (uri )
437443 self .assertEqual (scheme , 'http' )
438444 self .assertEqual (netloc , 'example.com' )
439- self .assertEqual (path , '/upload/storage/v1/ b/name/o' )
445+ self .assertEqual (path , '/b/name/o' )
440446 self .assertEqual (dict (parse_qsl (qs )),
441447 {'uploadType' : 'media' , 'name' : 'key' })
442448 headers = dict (
@@ -806,10 +812,13 @@ def api_request(self, **kw):
806812 return self ._respond (** kw )
807813
808814 def build_api_url (self , path , query_params = None ,
809- api_base_url = API_BASE_URL ):
815+ api_base_url = API_BASE_URL , upload = False ):
810816 from urllib import urlencode
811817 from urlparse import urlsplit
812818 from urlparse import urlunsplit
819+ # mimic the build_api_url interface, but avoid unused param and
820+ # missed coverage errors
821+ upload = not upload # pragma NO COVER
813822 qs = urlencode (query_params or {})
814823 scheme , netloc , _ , _ , _ = urlsplit (api_base_url )
815824 return urlunsplit ((scheme , netloc , path , qs , '' ))
0 commit comments