~ubuntu-branches/ubuntu/quantal/nova/quantal-proposed

« back to all changes in this revision

Viewing changes to nova/tests/test_api.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-08-16 14:04:11 UTC
  • mto: This revision was merged to the branch mainline in revision 84.
  • Revision ID: package-import@ubuntu.com-20120816140411-0mr4n241wmk30t9l
Tags: upstream-2012.2~f3
ImportĀ upstreamĀ versionĀ 2012.2~f3

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
"""Unit tests for the API endpoint"""
20
20
 
21
 
import httplib
22
21
import random
23
22
import StringIO
24
23
 
25
24
import boto
26
25
from boto.ec2 import regioninfo
27
26
from boto import exception as boto_exc
 
27
# newer versions of boto use their own wrapper on top of httplib.HTTPResponse
 
28
try:
 
29
    from boto.connection import HTTPResponse
 
30
except ImportError:
 
31
    from httplib import HTTPResponse
28
32
import webob
29
33
 
30
34
from nova.api import auth
58
62
 
59
63
    requests made via this connection actually get translated and routed into
60
64
    our WSGI app, we then wait for the response and turn it back into
61
 
    the httplib.HTTPResponse that boto expects.
 
65
    the HTTPResponse that boto expects.
62
66
    """
63
67
    def __init__(self, app, host, is_secure=False):
64
68
        self.app = app
77
81
        # guess that's a function the web server usually provides.
78
82
        resp = "HTTP/1.0 %s" % resp
79
83
        self.sock = FakeHttplibSocket(resp)
80
 
        self.http_response = httplib.HTTPResponse(self.sock)
 
84
        self.http_response = HTTPResponse(self.sock)
81
85
        # NOTE(vish): boto is accessing private variables for some reason
82
86
        self._HTTPConnection__response = self.http_response
83
87
        self.http_response.begin()