summaryrefslogtreecommitdiff
path: root/tests/unit/utils.py
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2015-05-18 08:05:02 -0700
committerTim Burke <tim.burke@gmail.com>2015-09-03 13:46:03 -0700
commitce569f46517e10f2ce0d27e9ee0a922ad1d84e2f (patch)
tree1a32030d29466ae4d63345d26a135abde1b12fea /tests/unit/utils.py
parentff073ab34a10230cc78a4daa3cab2e22bf1fd17d (diff)
downloadpython-swiftclient-ce569f46517e10f2ce0d27e9ee0a922ad1d84e2f.tar.gz
Centralize header parsing
All response headers are now exposed as unicode objects. Any url-encoding is interpretted as UTF-8; if that causes decoding to fail, the url-encoded form is returned. As a result, deleting DLOs with unicode characters will no longer raise UnicodeEncodeErrors under Python 2. Related-Bug: #1431866 Change-Id: Idb111c5bf3ac1f5ccfa724b3f4ede8f37d5bfac4
Diffstat (limited to 'tests/unit/utils.py')
-rw-r--r--tests/unit/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/unit/utils.py b/tests/unit/utils.py
index ac9aefd..a9759eb 100644
--- a/tests/unit/utils.py
+++ b/tests/unit/utils.py
@@ -124,7 +124,7 @@ def fake_http_connect(*code_iter, **kwargs):
def getheaders(self):
if self.headers:
return self.headers.items()
- headers = {'content-length': len(self.body),
+ headers = {'content-length': str(len(self.body)),
'content-type': 'x-application/test',
'x-timestamp': self.timestamp,
'last-modified': self.timestamp,
@@ -132,7 +132,7 @@ def fake_http_connect(*code_iter, **kwargs):
'etag':
self.etag or '"%s"' % EMPTY_ETAG,
'x-works': 'yes',
- 'x-account-container-count': 12345}
+ 'x-account-container-count': '12345'}
if not self.timestamp:
del headers['x-timestamp']
try: