py3: Fix up probe tests

Change-Id: Ic0f54f393002e2170e7f1459625ee5a2b37df900
This commit is contained in:
Tim Burke 2020-02-03 13:01:51 -08:00
parent 01b1d60cd9
commit ff885d30e4
2 changed files with 9 additions and 8 deletions

View File

@ -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)

View File

@ -358,8 +358,9 @@ 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),
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)
@ -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)