summaryrefslogtreecommitdiff
path: root/glanceclient/tests/unit/test_http.py
diff options
context:
space:
mode:
authorSirushti Murugesan <sirushti.murugesan@hp.com>2016-06-23 19:08:51 +0530
committerSirushti Murugesan <sirushti.murugesan@hp.com>2016-07-25 20:13:08 +0530
commit376037d3716244c32acf7fd4c096c99a8fa1b4c7 (patch)
tree53009c569e7ab7f37b3f64db563eebafb75088f0 /glanceclient/tests/unit/test_http.py
parenta0d1cc974e78c1f3e447e847d6a2dbb50ab3c582 (diff)
downloadpython-glanceclient-376037d3716244c32acf7fd4c096c99a8fa1b4c7.tar.gz
py3: Fix encoding and use sys.stdin.buffer
* exc.py: Encode body in response before calling replace over it. * http.py: prepend the bytes literal to the empty string or else we hit bug 1342080 again in python 3. * utils.py: Use sys.stdin.buffer in python 3. Change-Id: Ieefb8c633658e507486438e5518c5d53e819027d
Diffstat (limited to 'glanceclient/tests/unit/test_http.py')
-rw-r--r--glanceclient/tests/unit/test_http.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/glanceclient/tests/unit/test_http.py b/glanceclient/tests/unit/test_http.py
index 28ae8e1..020e146 100644
--- a/glanceclient/tests/unit/test_http.py
+++ b/glanceclient/tests/unit/test_http.py
@@ -239,6 +239,14 @@ class TestClient(testtools.TestCase):
test_client = http.HTTPClient(endpoint, token=u'adc123')
self.assertEqual(600.0, test_client.timeout)
+ def test__chunk_body_exact_size_chunk(self):
+ test_client = http._BaseHTTPClient()
+ bytestring = b'x' * http.CHUNKSIZE
+ data = six.BytesIO(bytestring)
+ chunk = list(test_client._chunk_body(data))
+ self.assertEqual(1, len(chunk))
+ self.assertEqual([bytestring], chunk)
+
def test_http_chunked_request(self):
text = "Ok"
data = six.StringIO(text)