From 258420f41049d92fc0b59b9263c8381bfe513432 Mon Sep 17 00:00:00 2001 From: Christian Schwede Date: Tue, 20 May 2014 11:41:03 +0000 Subject: Fix Python3 bugs This patch fixes three issues that were found running functional tests with Python 3: 1. python-requests sets 'application/x-www-form-urlencoded' as content-type if the input is not a string object and no content-type is given. 2. Encoding of the headers is now only done if required. This prevents comparisons between unencoded headers and encoded prefixes and avoids unnecessary forloop-iterations. One unittest was extended to ensure it works for unencoded and encoded headers with or without the prefix. 3. Functional tests recently switched to using byte data for testing, thus the comparison needs to be a byte object as well. Change-Id: I035f8b4b9c9ccdc79820b907770a48f86d0343b4 --- tests/functional/test_swiftclient.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/functional/test_swiftclient.py') diff --git a/tests/functional/test_swiftclient.py b/tests/functional/test_swiftclient.py index 6631d36..3721e51 100644 --- a/tests/functional/test_swiftclient.py +++ b/tests/functional/test_swiftclient.py @@ -259,7 +259,7 @@ class TestFunctional(testtools.TestCase): self.containername, self.objectname, resp_chunk_size=10) self.assertTrue(isinstance(body, types.GeneratorType)) - self.assertEqual(self.test_data, ''.join(body)) + self.assertEqual(self.test_data, b''.join(body)) def test_post_account(self): self.conn.post_account({'x-account-meta-data': 'Something'}) -- cgit v1.2.1