diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-07-23 18:33:11 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-07-23 18:33:11 +0000 |
| commit | fc77e8ed3bbc114816c87d368e9cad92a002a82b (patch) | |
| tree | ccdbed2b0dff3fdf1a30ee056e95fcf6cc3be8c9 | |
| parent | 563ed09b9a35e50e24ca10c9a588df119e9a7725 (diff) | |
| parent | 3dd86f5e571aead0b3e9a432b59c21fe8bc32794 (diff) | |
| download | nova-fc77e8ed3bbc114816c87d368e9cad92a002a82b.tar.gz nova-fc77e8ed3bbc114816c87d368e9cad92a002a82b.tar.xz nova-fc77e8ed3bbc114816c87d368e9cad92a002a82b.zip | |
Merge "use boto's HTTPResponse class for versions of boto >=2.5.2"
| -rw-r--r-- | nova/tests/test_api.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/nova/tests/test_api.py b/nova/tests/test_api.py index fe29db741..f176231d2 100644 --- a/nova/tests/test_api.py +++ b/nova/tests/test_api.py @@ -18,13 +18,17 @@ """Unit tests for the API endpoint""" -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.api import auth @@ -58,7 +62,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 @@ -77,7 +81,7 @@ class FakeHttplibConnection(object): # 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() |
