Skip to content

Commit 99db799

Browse files
authored
Updating some storage mocks after google-resumable-media==0.3.1 release. (googleapis#4244)
Fixes googleapis#4243. Also increasing the lower-bound on `google-resumable-media` to `0.3.1`.
1 parent 6dbb16c commit 99db799

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

storage/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
REQUIREMENTS = [
5454
'google-cloud-core >= 0.27.0, < 0.28dev',
5555
'google-auth >= 1.0.0',
56-
'google-resumable-media >= 0.3.0',
56+
'google-resumable-media >= 0.3.1',
5757
'requests >= 2.18.0',
5858
]
5959

storage/tests/unit/test_blob.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,9 @@ def _mock_requests_response(
441441
response.status_code = status_code
442442
response.headers.update(headers)
443443
if stream:
444-
response.raw = io.BytesIO(content)
444+
raw = io.BytesIO(content)
445+
raw.headers = headers
446+
response.raw = raw
445447
response._content = False
446448
else:
447449
response.raw = None
@@ -677,15 +679,18 @@ def test_download_to_filename_corrupted(self):
677679
empty_hash = base64.b64encode(
678680
hashlib.md5(b'').digest()).decode(u'utf-8')
679681
headers = {'x-goog-hash': 'md5=' + empty_hash}
682+
mock_raw = mock.Mock(headers=headers, spec=['headers'])
680683
response = mock.MagicMock(
681684
headers=headers,
682685
status_code=http_client.OK,
686+
raw=mock_raw,
683687
spec=[
684688
'__enter__',
685689
'__exit__',
686690
'headers',
687691
'iter_content',
688692
'status_code',
693+
'raw',
689694
],
690695
)
691696
# i.e. context manager returns ``self``.

0 commit comments

Comments
 (0)