diff --git a/test/probe/brain.py b/test/probe/brain.py index 6b94a3122b..e8eb8ca547 100644 --- a/test/probe/brain.py +++ b/test/probe/brain.py @@ -14,13 +14,13 @@ from __future__ import print_function import functools import sys +from io import BytesIO import itertools import uuid from optparse import OptionParser import random import six -from six import StringIO from six.moves.urllib.parse import urlparse, parse_qs, quote from swift.common.manager import Manager @@ -233,7 +233,7 @@ def translate_client_exception(m): return m(*args, **kwargs) except UnexpectedResponse as err: raise ClientException( - err.message, + err.args[0], http_scheme=err.resp.environ['wsgi.url_scheme'], http_host=err.resp.environ['SERVER_NAME'], http_port=err.resp.environ['SERVER_PORT'], @@ -274,7 +274,7 @@ class InternalBrainClient(object): @translate_client_exception def put_object(self, container_name, object_name, headers, contents, query_string=None): - return self.swift.upload_object(StringIO(contents), self.account, + return self.swift.upload_object(BytesIO(contents), self.account, container_name, object_name, headers=headers, params=self.parse_qs(query_string)) @@ -294,7 +294,7 @@ class InternalBrainClient(object): status, headers, resp_iter = self.swift.get_object( self.account, container_name, object_name, params=self.parse_qs(query_string)) - return headers, ''.join(resp_iter) + return headers, b''.join(resp_iter) @six.add_metaclass(meta_command) diff --git a/test/probe/test_container_merge_policy_index.py b/test/probe/test_container_merge_policy_index.py index f4a499d09d..665f621e97 100644 --- a/test/probe/test_container_merge_policy_index.py +++ b/test/probe/test_container_merge_policy_index.py @@ -358,9 +358,10 @@ class TestContainerMergePolicyIndex(ReplProbeTest): for i in range(20))) # and regular upload should work now too - self.brain.client.put_object(self.container_name, self.object_name, {}, - utils.json.dumps(manifest_data), - query_string='multipart-manifest=put') + self.brain.client.put_object( + self.container_name, self.object_name, {}, + utils.json.dumps(manifest_data).encode('ascii'), + query_string='multipart-manifest=put') metadata = self.brain.client.head_object(self.container_name, self.object_name) self.assertEqual(int(metadata['content-length']), @@ -392,7 +393,7 @@ class TestContainerMergePolicyIndex(ReplProbeTest): 'X-Symlink-Target': '%s/%s' % ( self.container_name, target_name), 'Content-Type': 'application/symlink', - }, '') + }, b'') # at this point we have a broken symlink (the container_info has the # proxy looking for the target in the wrong policy)