summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-06-15 13:37:19 +0000
committerGerrit Code Review <review@openstack.org>2012-06-15 13:37:19 +0000
commite4b4d3472341a30fc394e5c7e05d2307991711da (patch)
tree15d28ebd8f6873f5f0f480717aa3d2a5ffe97929 /nova
parent76636056d29b87f8bac95ca302621d9158d615e4 (diff)
parentcbd334d0a8b12bb78ff40a4bdc696a80fa6a393a (diff)
Merge "Unwrap httplib.HTTPConnection after WsgiLimiterProxyTest."
Diffstat (limited to 'nova')
-rw-r--r--nova/tests/api/openstack/compute/test_limits.py12
1 files changed, 11 insertions, 1 deletions
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):