From caa3c67e0b03fc15e1528778d7441498a8a7e451 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Tue, 29 May 2018 17:00:24 -0700 Subject: [PATCH] functests: Clean up objects better Since JSON object listings deserialize as unicode, obj['name'] would hoist *everything* to unicode. If the account or container name was a byte string, though, it would trip a UnicodeDecodeError. Change-Id: I2c1932143b78521c6bdcfa48182b475528fc1bb3 --- test/functional/test_container.py | 6 +++--- test/functional/test_object.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/functional/test_container.py b/test/functional/test_container.py index c9e9b4239f..c9b59db126 100644 --- a/test/functional/test_container.py +++ b/test/functional/test_container.py @@ -68,9 +68,9 @@ class TestContainer(unittest2.TestCase): return check_response(conn) def delete(url, token, parsed, conn, container, obj): - conn.request( - 'DELETE', '/'.join([parsed.path, container, obj['name']]), '', - {'X-Auth-Token': token}) + path = '/'.join([parsed.path, container, + obj['name'].encode('utf8')]) + conn.request('DELETE', path, '', {'X-Auth-Token': token}) return check_response(conn) for container in (self.name, self.container): diff --git a/test/functional/test_object.py b/test/functional/test_object.py index 796846d565..0e99b21dc0 100644 --- a/test/functional/test_object.py +++ b/test/functional/test_object.py @@ -104,9 +104,9 @@ class TestObject(unittest2.TestCase): # delete an object def delete(url, token, parsed, conn, container, obj): - conn.request( - 'DELETE', '/'.join([parsed.path, container, obj['name']]), '', - {'X-Auth-Token': token}) + path = '/'.join([parsed.path, container, + obj['name'].encode('utf8')]) + conn.request('DELETE', path, '', {'X-Auth-Token': token}) return check_response(conn) for container in self.containers: