From 346d9419a6aeb3c1277fa0ad2c539045be571d30 Mon Sep 17 00:00:00 2001 From: Sascha Peilicke Date: Thu, 20 Jun 2013 16:37:43 +0200 Subject: Port missing bits from httplib2 to requests This allows to drop the dependency on httplib2 altogether. Change-Id: I18571e29d9f0d6527a93ed18becee9148e64e574 --- nova/tests/test_cinder.py | 5 ++--- nova/tests/test_wsgi.py | 15 +++++++-------- requirements.txt | 1 - 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/nova/tests/test_cinder.py b/nova/tests/test_cinder.py index e8dff9a4a..98cc1c3f9 100644 --- a/nova/tests/test_cinder.py +++ b/nova/tests/test_cinder.py @@ -14,7 +14,6 @@ # License for the specific language governing permissions and limitations # under the License. -import httplib2 import urlparse from cinderclient import exceptions as cinder_exception @@ -76,9 +75,9 @@ class FakeHTTPClient(cinder.cinder_client.client.HTTPClient): status, body = getattr(self, callback)(**kwargs) if hasattr(status, 'items'): - return httplib2.Response(status), body + return status, body else: - return httplib2.Response({"status": status}), body + return {"status": status}, body def get_volumes_1234(self, **kw): volume = {'volume': _stub_volume(id='1234')} diff --git a/nova/tests/test_wsgi.py b/nova/tests/test_wsgi.py index d1d659fe3..7118aa938 100644 --- a/nova/tests/test_wsgi.py +++ b/nova/tests/test_wsgi.py @@ -23,8 +23,7 @@ import tempfile import testtools import eventlet -import httplib2 -import paste +import requests import nova.exception from nova import test @@ -119,16 +118,16 @@ class TestWSGIServer(test.TestCase): server.start() uri = "http://127.0.0.1:%d/%s" % (server.port, 10000 * 'x') - resp, _ = httplib2.Http().request(uri) + resp = requests.get(uri) eventlet.sleep(0) - self.assertNotEqual(resp.status, - paste.httpexceptions.HTTPRequestURITooLong.code) + self.assertNotEqual(resp.status_code, + requests.codes.REQUEST_URI_TOO_LARGE) uri = "http://127.0.0.1:%d/%s" % (server.port, 20000 * 'x') - resp, _ = httplib2.Http().request(uri) + resp = requests.get(uri) eventlet.sleep(0) - self.assertEqual(resp.status, - paste.httpexceptions.HTTPRequestURITooLong.code) + self.assertEqual(resp.status_code, + requests.codes.REQUEST_URI_TOO_LARGE) server.stop() server.wait() diff --git a/requirements.txt b/requirements.txt index 298c6b2c9..1f0ddbdd0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,7 +21,6 @@ paramiko pyasn1 Babel>=0.9.6 iso8601>=0.1.4 -httplib2 requests>=1.1,<1.2.1 # order-dependent python-cinderclient req cap, bug 1182271 python-cinderclient>=1.0.1 python-quantumclient>=2.2.0,<3.0.0 -- cgit