def test_create_resumable_upload_session_with_failure(self):
    from google.resumable_media import InvalidResponse
    from google.cloud import exceptions
    message = b'5-oh-3 woe is me.'
    response = self._mock_requests_response(content=message, status_code=http_client.SERVICE_UNAVAILABLE, headers={})
    side_effect = InvalidResponse(response)
    with self.assertRaises(exceptions.ServiceUnavailable) as exc_info:
        self._create_resumable_upload_session_helper(side_effect=side_effect)
    self.assertIn(message.decode('utf-8'), exc_info.exception.message)
    self.assertEqual(exc_info.exception.errors, [])
def test_create_resumable_upload_session_with_failure(self):
    from google.resumable_media import InvalidResponse
    from google.cloud import exceptions
    message = b'5-oh-3 woe is me.'
    response = self._mock_requests_response(content=message, status_code=http_client.SERVICE_UNAVAILABLE, headers={})
    side_effect = InvalidResponse(response)
    with self.assertRaises(exceptions.ServiceUnavailable) as exc_info:
        self._create_resumable_upload_session_helper(side_effect=side_effect)
    self.assertIn(message.decode('utf-8'), exc_info.exception.message)
    self.assertEqual(exc_info.exception.errors, [])