diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-05-07 07:24:16 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-05-07 07:27:58 -0700 |
commit | 30244399dd15647f09e882d5ff514006a963ed65 (patch) | |
tree | a4fdceee45531973a53564f268bc8d34b51ad957 /tests/functional/test_swiftclient.py | |
parent | 4e85183019da3c1a4b350d4b426b43de5a492727 (diff) | |
download | python-swiftclient-30244399dd15647f09e882d5ff514006a963ed65.tar.gz |
Make the function tests Python3-import friendly
Change-Id: Ic73fc2a6f6712505eda71fa2e2e91ac680ced9a3
Diffstat (limited to 'tests/functional/test_swiftclient.py')
-rw-r--r-- | tests/functional/test_swiftclient.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/functional/test_swiftclient.py b/tests/functional/test_swiftclient.py index 891ba54..6631d36 100644 --- a/tests/functional/test_swiftclient.py +++ b/tests/functional/test_swiftclient.py @@ -13,13 +13,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import ConfigParser import os -import StringIO import testtools import time import types import unittest +from io import BytesIO + +from six.moves import configparser import swiftclient @@ -31,7 +32,7 @@ class TestFunctional(testtools.TestCase): self.skip_tests = False self._get_config() - self.test_data = '42' * 10 + self.test_data = b'42' * 10 self.etag = '2704306ec982238d85d4b235c925d58e' self.containername = "functional-tests-container-%s" % int(time.time()) @@ -43,7 +44,7 @@ class TestFunctional(testtools.TestCase): def _get_config(self): config_file = os.environ.get('SWIFT_TEST_CONFIG_FILE', '/etc/swift/test.conf') - config = ConfigParser.SafeConfigParser({'auth_version': '1'}) + config = configparser.SafeConfigParser({'auth_version': '1'}) config.read(config_file) if config.has_section('func_test'): auth_host = config.get('func_test', 'auth_host') @@ -220,7 +221,7 @@ class TestFunctional(testtools.TestCase): self.assertEqual('application/octet-stream', hdrs.get('content-type')) # Content from File-like object - fileobj = StringIO.StringIO(self.test_data) + fileobj = BytesIO(self.test_data) self.conn.put_object( self.containername, self.objectname, contents=fileobj) hdrs = self.conn.head_object(self.containername, self.objectname) @@ -230,7 +231,7 @@ class TestFunctional(testtools.TestCase): self.assertEqual('application/octet-stream', hdrs.get('content-type')) # Content from File-like object, but read in chunks - fileobj = StringIO.StringIO(self.test_data) + fileobj = BytesIO(self.test_data) self.conn.put_object( self.containername, self.objectname, contents=fileobj, content_length=len(self.test_data), |