def _helper(self, message, **kwargs):
    import requests
    from google.resumable_media import InvalidResponse
    from google.cloud import exceptions
    response = requests.Response()
    response.request = requests.Request('GET', 'http://example.com').prepare()
    response.status_code = http_client.BAD_REQUEST
    response._content = message
    error = InvalidResponse(response)
    with self.assertRaises(exceptions.BadRequest) as exc_info:
        self._call_fut(error, **kwargs)
    return exc_info
def _helper(self, message, **kwargs):
    import requests
    from google.resumable_media import InvalidResponse
    from google.cloud import exceptions
    response = requests.Response()
    response.request = requests.Request('GET', 'http://example.com').prepare()
    response.status_code = http_client.BAD_REQUEST
    response._content = message
    error = InvalidResponse(response)
    with self.assertRaises(exceptions.BadRequest) as exc_info:
        self._call_fut(error, **kwargs)
    return exc_info