summaryrefslogtreecommitdiff
path: root/tests/test_swiftclient.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@enovance.com>2014-03-31 12:40:24 +0200
committerVictor Stinner <victor.stinner@enovance.com>2014-04-07 10:30:18 +0200
commit155053ea61bb7a9afc19dc289886231e238bb298 (patch)
tree5ec7ccf332dfcbdc71549df84a09efb15fb7f189 /tests/test_swiftclient.py
parentc5cc2b7b7e90edfa41d35ccf1dac13e0f7ac2da0 (diff)
downloadpython-swiftclient-155053ea61bb7a9afc19dc289886231e238bb298.tar.gz
Fix swiftclient.client.quote() for Python 3
On Python 3, urllib.parse.quote() accepts bytes and str (unicode) types and always return str (unicode). Add also more tests with non-ASCII characters. Change-Id: I8e0f19da7240e874392327d0da074ed4abb7d213
Diffstat (limited to 'tests/test_swiftclient.py')
-rw-r--r--tests/test_swiftclient.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/test_swiftclient.py b/tests/test_swiftclient.py
index 80f074c..f18856d 100644
--- a/tests/test_swiftclient.py
+++ b/tests/test_swiftclient.py
@@ -182,10 +182,14 @@ class MockHttpResponse():
class TestHttpHelpers(MockHttpTest):
def test_quote(self):
- value = 'standard string'
- self.assertEqual(b'standard%20string', c.quote(value))
- value = u'\u0075nicode string'
- self.assertEqual(b'unicode%20string', c.quote(value))
+ value = b'bytes\xff'
+ self.assertEqual('bytes%FF', c.quote(value))
+ value = 'native string'
+ self.assertEqual('native%20string', c.quote(value))
+ value = u'unicode string'
+ self.assertEqual('unicode%20string', c.quote(value))
+ value = u'unicode:\xe9\u20ac'
+ self.assertEqual('unicode%3A%C3%A9%E2%82%AC', c.quote(value))
def test_http_connection(self):
url = 'http://www.test.com'