def test__do_download_simple(self):
    blob_name = 'blob-name'
    client = mock.Mock(_credentials=_make_credentials(), spec=['_credentials'])
    bucket = _Bucket(client)
    blob = self._make_one(blob_name, bucket=bucket)
    self.assertIsNone(blob.chunk_size)
    transport = mock.Mock(spec=['request'])
    transport.request.return_value = self._mock_requests_response(http_client.OK, {'content-length': '6', 'content-range': 'bytes 0-5/6'}, content=b'abcdef')
    file_obj = io.BytesIO()
    download_url = 'http://test.invalid'
    headers = {}
    blob._do_download(transport, file_obj, download_url, headers)
    self.assertEqual(file_obj.getvalue(), b'abcdef')
    transport.request.assert_called_once_with('GET', download_url, data=None, headers=headers)
def test__do_download_simple(self):
    blob_name = 'blob-name'
    client = mock.Mock(_credentials=_make_credentials(), spec=['_credentials'])
    bucket = _Bucket(client)
    blob = self._make_one(blob_name, bucket=bucket)
    self.assertIsNone(blob.chunk_size)
    transport = mock.Mock(spec=['request'])
    transport.request.return_value = self._mock_requests_response(http_client.OK, {'content-length': '6', 'content-range': 'bytes 0-5/6'}, content=b'abcdef')
    file_obj = io.BytesIO()
    download_url = 'http://test.invalid'
    headers = {}
    blob._do_download(transport, file_obj, download_url, headers)
    self.assertEqual(file_obj.getvalue(), b'abcdef')
    transport.request.assert_called_once_with('GET', download_url, data=None, headers=headers)