fix py34 tests
tests should use six.iteritems to pass py34 tests. also, encode doesn't work consistently across py2 and py3 Change-Id: I1ec858b61ec3786b139be8736a6e1fd1a47f5845 Closes-Bug: #1417303
This commit is contained in:
parent
1928cbb221
commit
468cedc34b
|
@ -150,7 +150,7 @@ class Swift(object):
|
|||
if header.startswith('HTTP_') and env[header]:
|
||||
key = header[5:]
|
||||
if isinstance(env[header], six.text_type):
|
||||
headers[key] = env[header].encode('utf-8')
|
||||
headers[key] = six.text_type(env[header])
|
||||
else:
|
||||
headers[key] = str(env[header])
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class FakeRequest(object):
|
|||
if 'wsgi.input' not in environ:
|
||||
environ['wsgi.input'] = six.moves.cStringIO('')
|
||||
|
||||
for header, value in headers.iteritems():
|
||||
for header, value in six.iteritems(headers):
|
||||
environ['HTTP_%s' % header.upper()] = value
|
||||
self.environ = environ
|
||||
|
||||
|
@ -248,7 +248,7 @@ class TestSwift(tests_base.TestCase):
|
|||
http_headers = [k for k in metadata.keys()
|
||||
if k.startswith('http_header_')]
|
||||
self.assertEqual(1, len(http_headers))
|
||||
self.assertEqual(uni.encode('utf-8'),
|
||||
self.assertEqual(six.text_type(uni),
|
||||
metadata['http_header_unicode'])
|
||||
|
||||
def test_metadata_headers_on_not_existing_header(self):
|
||||
|
|
Loading…
Reference in New Issue