From 928935e5c0b8b43827fdf08b212d59d92b660924 Mon Sep 17 00:00:00 2001 From: Cyril Roelandt Date: Mon, 15 Jun 2020 20:58:52 +0200 Subject: Do not use the six library in the tests. Change-Id: Ic8a2a736a733e0151ca82f19bfde428dc04cf255 --- glanceclient/tests/unit/test_http.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'glanceclient/tests/unit/test_http.py') diff --git a/glanceclient/tests/unit/test_http.py b/glanceclient/tests/unit/test_http.py index 0cf8f5b..689074b 100644 --- a/glanceclient/tests/unit/test_http.py +++ b/glanceclient/tests/unit/test_http.py @@ -19,13 +19,13 @@ from unittest import mock import uuid import fixtures +import io from keystoneauth1 import session from keystoneauth1 import token_endpoint from oslo_utils import encodeutils import requests from requests_mock.contrib import fixture -import six -from six.moves.urllib import parse +from urllib import parse from testscenarios import load_tests_apply_scenarios as load_tests # noqa import testtools from testtools import matchers @@ -296,14 +296,14 @@ class TestClient(testtools.TestCase): def test__chunk_body_exact_size_chunk(self): test_client = http._BaseHTTPClient() bytestring = b'x' * http.CHUNKSIZE - data = six.BytesIO(bytestring) + data = io.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) + data = io.StringIO(text) path = '/v1/images/' self.mock.post(self.endpoint + path, text=text) @@ -322,13 +322,13 @@ class TestClient(testtools.TestCase): resp, body = self.client.post(path, headers=headers, data=data) self.assertEqual(text, resp.text) - self.assertIsInstance(self.mock.last_request.body, six.string_types) + self.assertIsInstance(self.mock.last_request.body, str) self.assertEqual(data, json.loads(self.mock.last_request.body)) def test_http_chunked_response(self): data = "TEST" path = '/v1/images/' - self.mock.get(self.endpoint + path, body=six.StringIO(data), + self.mock.get(self.endpoint + path, body=io.StringIO(data), headers={"Content-Type": "application/octet-stream"}) resp, body = self.client.get(path) @@ -341,7 +341,7 @@ class TestClient(testtools.TestCase): response = 'Ok' headers = {"Content-Type": "text/plain", "test": "value1\xa5\xa6"} - fake = utils.FakeResponse(headers, six.StringIO(response)) + fake = utils.FakeResponse(headers, io.StringIO(response)) self.client.log_http_response(fake) except UnicodeDecodeError as e: self.fail("Unexpected UnicodeDecodeError exception '%s'" % e) @@ -444,7 +444,7 @@ class TestClient(testtools.TestCase): logger = self.useFixture(fixtures.FakeLogger(level=logging.DEBUG)) data = "TEST" path = '/v1/images/' - self.mock.get(self.endpoint + path, body=six.StringIO(data), + self.mock.get(self.endpoint + path, body=io.StringIO(data), headers={"Content-Type": "application/octet-stream", 'x-openstack-request-id': "1234"}) -- cgit v1.2.1