Port missing bits from httplib2 to requests

This allows to drop the dependency on httplib2 altogether.

Change-Id: I18571e29d9f0d6527a93ed18becee9148e64e574
This commit is contained in:
Sascha Peilicke
2013-06-20 16:37:43 +02:00
parent 75ead3a2a3
commit 346d9419a6
3 changed files with 9 additions and 12 deletions
+2 -3
View File
@@ -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')}
+7 -8
View File
@@ -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()
-1
View File
@@ -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