diff options
author | Tim Burke <tim.burke@gmail.com> | 2019-07-25 11:21:29 -0700 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2019-07-25 14:21:43 -0700 |
commit | 7175069b3e95c38070bb4373019f78c87ab103d0 (patch) | |
tree | 740d69eb72f39e68752be713188fdb1e4269a9ed /tests/functional/test_swiftclient.py | |
parent | 5bd66947fc3d8987d4b24d5119a346031004229e (diff) | |
download | python-swiftclient-7175069b3e95c38070bb4373019f78c87ab103d0.tar.gz |
Fix up requests so we can send non-RFC-compliant headers on py3
Change-Id: I3dac826c1f208569c5f40431f59a2045e5744415
Diffstat (limited to 'tests/functional/test_swiftclient.py')
-rw-r--r-- | tests/functional/test_swiftclient.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/functional/test_swiftclient.py b/tests/functional/test_swiftclient.py index bae3044..9a74c63 100644 --- a/tests/functional/test_swiftclient.py +++ b/tests/functional/test_swiftclient.py @@ -18,6 +18,7 @@ import unittest import time from io import BytesIO +import six from six.moves import configparser import swiftclient @@ -446,6 +447,22 @@ class TestFunctional(unittest.TestCase): self.assertEqual('45.67', headers.get('x-object-meta-float')) self.assertEqual('False', headers.get('x-object-meta-bool')) + def test_post_object_unicode_header_name(self): + self.conn.post_object(self.containername, + self.objectname, + {u'x-object-meta-\U0001f44d': u'\U0001f44d'}) + + # Note that we can't actually read this header back on py3; see + # https://bugs.python.org/issue37093 + # We'll have to settle for just testing that the POST doesn't blow up + # with a UnicodeDecodeError + if six.PY2: + headers = self.conn.head_object( + self.containername, self.objectname) + self.assertIn(u'x-object-meta-\U0001f44d', headers) + self.assertEqual(u'\U0001f44d', + headers.get(u'x-object-meta-\U0001f44d')) + def test_copy_object(self): self.conn.put_object( self.containername, self.objectname, self.test_data) |