Skip to content

Commit

Permalink
use boto's HTTPResponse class for versions of boto >=2.5.2
Browse files Browse the repository at this point in the history
Fixes bug: 1027984

Change-Id: I2101ddaa78ede90f39b55d28aab73e7f5a816af5
  • Loading branch information
iartarisi committed Jul 24, 2012
1 parent 5e6795a commit 7e88e39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions Authors
Expand Up @@ -74,6 +74,7 @@ Hengqing Hu <hudayou@hotmail.com>
Hisaharu Ishii <ishii.hisaharu@lab.ntt.co.jp>
Hisaki Ohara <hisaki.ohara@intel.com>
Ilya Alekseyev <ilyaalekseyev@acm.org>
Ionuț Arțăriși <iartarisi@suse.cz>
Isaku Yamahata <yamahata@valinux.co.jp>
Ivan Kolodyazhny <e0ne@e0ne.info>
J. Daniel Schmidt <jdsn@suse.de>
Expand Down
10 changes: 7 additions & 3 deletions nova/tests/test_api.py
Expand Up @@ -19,13 +19,17 @@
"""Unit tests for the API endpoint"""

import datetime
import httplib
import random
import StringIO

import boto
from boto.ec2 import regioninfo
from boto import exception as boto_exc
# newer versions of boto use their own wrapper on top of httplib.HTTPResponse
try:
from boto.connection import HTTPResponse
except ImportError:
from httplib import HTTPResponse
import webob

from nova import block_device
Expand Down Expand Up @@ -55,7 +59,7 @@ class FakeHttplibConnection(object):
requests made via this connection actually get translated and routed into
our WSGI app, we then wait for the response and turn it back into
the httplib.HTTPResponse that boto expects.
the HTTPResponse that boto expects.
"""
def __init__(self, app, host, is_secure=False):
self.app = app
Expand All @@ -74,7 +78,7 @@ def request(self, method, path, data, headers):
# guess that's a function the web server usually provides.
resp = "HTTP/1.0 %s" % resp
self.sock = FakeHttplibSocket(resp)
self.http_response = httplib.HTTPResponse(self.sock)
self.http_response = HTTPResponse(self.sock)
# NOTE(vish): boto is accessing private variables for some reason
self._HTTPConnection__response = self.http_response
self.http_response.begin()
Expand Down

0 comments on commit 7e88e39

Please sign in to comment.