Skip to content

Commit 1443984

Browse files
committed
Normalize API reponses as 'info, content'.
1 parent 63aa65c commit 1443984

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

gcloud/storage/test_blob.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def test_generate_signed_url_w_method_arg(self):
260260
def test_exists_miss(self):
261261
from six.moves.http_client import NOT_FOUND
262262
NONESUCH = 'nonesuch'
263-
not_found_response = {'status': NOT_FOUND}
263+
not_found_response = ({'status': NOT_FOUND}, b'')
264264
connection = _Connection(not_found_response)
265265
client = _Client(connection)
266266
bucket = _Bucket(client)
@@ -270,7 +270,7 @@ def test_exists_miss(self):
270270
def test_exists_hit(self):
271271
from six.moves.http_client import OK
272272
BLOB_NAME = 'blob-name'
273-
found_response = {'status': OK}
273+
found_response = ({'status': OK}, b'')
274274
connection = _Connection(found_response)
275275
client = _Client(connection)
276276
bucket = _Bucket(client)
@@ -281,7 +281,7 @@ def test_exists_hit(self):
281281
def test_delete(self):
282282
from six.moves.http_client import NOT_FOUND
283283
BLOB_NAME = 'blob-name'
284-
not_found_response = {'status': NOT_FOUND}
284+
not_found_response = ({'status': NOT_FOUND}, b'')
285285
connection = _Connection(not_found_response)
286286
client = _Client(connection)
287287
bucket = _Bucket(client)
@@ -749,10 +749,11 @@ def test_upload_from_string_w_text(self):
749749
self.assertEqual(rq[0]['body'], ENCODED)
750750

751751
def test_make_public(self):
752+
from six.moves.http_client import OK
752753
from gcloud.storage.acl import _ACLEntity
753754
BLOB_NAME = 'blob-name'
754755
permissive = [{'entity': 'allUsers', 'role': _ACLEntity.READER_ROLE}]
755-
after = {'acl': permissive}
756+
after = ({'status': OK}, {'acl': permissive})
756757
connection = _Connection(after)
757758
client = _Client(connection)
758759
bucket = _Bucket(client=client)
@@ -1092,10 +1093,10 @@ def __init__(self, *responses):
10921093
def api_request(self, **kw):
10931094
from six.moves.http_client import NOT_FOUND
10941095
from gcloud.exceptions import NotFound
1095-
result = self._respond(**kw)
1096-
if result.get('status') == NOT_FOUND:
1097-
raise NotFound(result)
1098-
return result
1096+
info, content = self._respond(**kw)
1097+
if info.get('status') == NOT_FOUND:
1098+
raise NotFound(info)
1099+
return content
10991100

11001101
def build_api_url(self, path, query_params=None,
11011102
api_base_url=API_BASE_URL):

0 commit comments

Comments
 (0)