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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user