@@ -156,9 +156,9 @@ def test_set_contents_from_file(self):
156156 KEY = 'key'
157157 UPLOAD_URL = 'http://example.com/upload/name/key'
158158 DATA = 'ABCDEF'
159- loc_response = _Response ( location = UPLOAD_URL )
160- chunk1_response = _Response ()
161- chunk2_response = _Response ()
159+ loc_response = { ' location' : UPLOAD_URL }
160+ chunk1_response = {}
161+ chunk2_response = {}
162162 connection = _Connection ((loc_response , '' ),
163163 (chunk1_response , '' ),
164164 (chunk2_response , '' ),
@@ -201,9 +201,9 @@ def test_set_contents_from_filename(self):
201201 KEY = 'key'
202202 UPLOAD_URL = 'http://example.com/upload/name/key'
203203 DATA = 'ABCDEF'
204- loc_response = _Response ( location = UPLOAD_URL )
205- chunk1_response = _Response ()
206- chunk2_response = _Response ()
204+ loc_response = { ' location' : UPLOAD_URL }
205+ chunk1_response = {}
206+ chunk2_response = {}
207207 connection = _Connection ((loc_response , '' ),
208208 (chunk1_response , '' ),
209209 (chunk2_response , '' ),
@@ -245,9 +245,9 @@ def test_set_contents_from_string(self):
245245 KEY = 'key'
246246 UPLOAD_URL = 'http://example.com/upload/name/key'
247247 DATA = 'ABCDEF'
248- loc_response = _Response ( location = UPLOAD_URL )
249- chunk1_response = _Response ()
250- chunk2_response = _Response ()
248+ loc_response = { ' location' : UPLOAD_URL }
249+ chunk1_response = {}
250+ chunk2_response = {}
251251 connection = _Connection ((loc_response , '' ),
252252 (chunk1_response , '' ),
253253 (chunk2_response , '' ),
@@ -556,12 +556,6 @@ def test_make_public(self):
556556 self .assertEqual (kw [0 ]['query_params' ], {'projection' : 'full' })
557557
558558
559- class _Response (dict ):
560- @property
561- def status (self ):
562- return self .get ('status' , 200 )
563-
564-
565559class _Connection (object ):
566560 API_BASE_URL = 'http://example.com'
567561
@@ -570,24 +564,14 @@ def __init__(self, *responses):
570564 self ._requested = []
571565
572566 def make_request (self , ** kw ):
573- from gcloud .storage .exceptions import NotFoundError
574567 self ._requested .append (kw )
575- try :
576- response , self ._responses = self ._responses [0 ], self ._responses [1 :]
577- except :
578- raise NotFoundError ('miss' , None )
579- else :
580- return response
568+ response , self ._responses = self ._responses [0 ], self ._responses [1 :]
569+ return response
581570
582571 def api_request (self , ** kw ):
583- from gcloud .storage .exceptions import NotFoundError
584572 self ._requested .append (kw )
585- try :
586- response , self ._responses = self ._responses [0 ], self ._responses [1 :]
587- except :
588- raise NotFoundError ('miss' , None )
589- else :
590- return response
573+ response , self ._responses = self ._responses [0 ], self ._responses [1 :]
574+ return response
591575
592576 def build_api_url (self , path , query_params = None ,
593577 api_base_url = API_BASE_URL ):
0 commit comments