summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Authors1
-rw-r--r--nova/tests/api/openstack/compute/test_limits.py12
2 files changed, 12 insertions, 1 deletions
diff --git a/Authors b/Authors
index a8f1fc88c..31d6e93dd 100644
--- a/Authors
+++ b/Authors
@@ -67,6 +67,7 @@ Edouard Thuleau <edouard1.thuleau@orange.com>
Eldar Nugaev <reldan@oscloud.ru>
Eoghan Glynn <eglynn@redhat.com>
Eric Day <eday@oddments.org>
+Eric Harney <eharney@gmail.com>
Eric Windisch <eric@cloudscaling.com>
Evan Callicoat <diopter@gmail.com>
Ewan Mellor <ewan.mellor@citrix.com>
diff --git a/nova/tests/api/openstack/compute/test_limits.py b/nova/tests/api/openstack/compute/test_limits.py
index b9450ae5d..c08dc5cef 100644
--- a/nova/tests/api/openstack/compute/test_limits.py
+++ b/nova/tests/api/openstack/compute/test_limits.py
@@ -730,6 +730,9 @@ def wire_HTTPConnection_to_WSGI(host, app):
This method may be called multiple times to map different hosts to
different apps.
+
+ This method returns the original HTTPConnection object, so that the caller
+ can restore the default HTTPConnection interface (for all hosts).
"""
class HTTPConnectionDecorator(object):
"""Wraps the real HTTPConnection class so that when you instantiate
@@ -744,7 +747,9 @@ def wire_HTTPConnection_to_WSGI(host, app):
else:
return self.wrapped(connection_host, *args, **kwargs)
+ oldHTTPConnection = httplib.HTTPConnection
httplib.HTTPConnection = HTTPConnectionDecorator(httplib.HTTPConnection)
+ return oldHTTPConnection
class WsgiLimiterProxyTest(BaseLimitTestSuite):
@@ -759,7 +764,8 @@ class WsgiLimiterProxyTest(BaseLimitTestSuite):
"""
super(WsgiLimiterProxyTest, self).setUp()
self.app = limits.WsgiLimiter(TEST_LIMITS)
- wire_HTTPConnection_to_WSGI("169.254.0.1:80", self.app)
+ self.oldHTTPConnection = (
+ wire_HTTPConnection_to_WSGI("169.254.0.1:80", self.app))
self.proxy = limits.WsgiLimiterProxy("169.254.0.1:80")
def test_200(self):
@@ -780,6 +786,10 @@ class WsgiLimiterProxyTest(BaseLimitTestSuite):
self.assertEqual((delay, error), expected)
+ def tearDown(self):
+ # restore original HTTPConnection object
+ httplib.HTTPConnection = self.oldHTTPConnection
+
class LimitsViewBuilderTest(test.TestCase):
def setUp(self):