diff options
| author | Eric Harney <eharney@gmail.com> | 2012-06-12 21:23:47 -0400 |
|---|---|---|
| committer | Eric Harney <eharney@gmail.com> | 2012-06-13 22:22:01 -0400 |
| commit | cbd334d0a8b12bb78ff40a4bdc696a80fa6a393a (patch) | |
| tree | 62097e51f2c615b81e7f629de6cbefc7d922f62c | |
| parent | cd085d0ce74fc478c04f1f61c0e5c22d7aa6d208 (diff) | |
| download | nova-cbd334d0a8b12bb78ff40a4bdc696a80fa6a393a.tar.gz nova-cbd334d0a8b12bb78ff40a4bdc696a80fa6a393a.tar.xz nova-cbd334d0a8b12bb78ff40a4bdc696a80fa6a393a.zip | |
Unwrap httplib.HTTPConnection after WsgiLimiterProxyTest.
Fixes bug 1007307.
Change-Id: I0b84d29a86a727b611f60f6be15a6d0d21c17a4b
| -rw-r--r-- | Authors | 1 | ||||
| -rw-r--r-- | nova/tests/api/openstack/compute/test_limits.py | 12 |
2 files changed, 12 insertions, 1 deletions
@@ -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): |
