diff options
author | Tim Burke <tim.burke@gmail.com> | 2016-08-25 10:51:29 -0700 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2016-08-25 11:32:08 -0700 |
commit | ab60e08e2e34ac4a87bc6c1701c6ace69bb392cf (patch) | |
tree | b955ac317d9463bb8a2a6f453f56fd116050ef04 /tests/functional/test_swiftclient.py | |
parent | 5acefd27e4e4de01414cc67f6652cc946b51957b (diff) | |
download | python-swiftclient-ab60e08e2e34ac4a87bc6c1701c6ace69bb392cf.tar.gz |
Convert numeric and boolean header values to strings
Recently, requests got a bit more picky about what types of data it will
accept as header values [1]. The reasons for this are generally sound;
str()ing arbitrary objects just before pushing them out a socket may not
do what the developer wanted/expected.
However, there are a few standard types that developers may be sending
that we should convert for them as a convenience. Now, we'll convert all
int, float, and bool values to strings before sending them on to
requests.
Change-Id: I6c2f451009cb03cb78812f54e4ed8566076de821
Closes-Bug: 1614932
Diffstat (limited to 'tests/functional/test_swiftclient.py')
-rw-r--r-- | tests/functional/test_swiftclient.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/functional/test_swiftclient.py b/tests/functional/test_swiftclient.py index 6e19abd..0e6a346 100644 --- a/tests/functional/test_swiftclient.py +++ b/tests/functional/test_swiftclient.py @@ -400,10 +400,19 @@ class TestFunctional(unittest.TestCase): def test_post_object(self): self.conn.post_object(self.containername, self.objectname, - {'x-object-meta-color': 'Something'}) + {'x-object-meta-color': 'Something', + 'x-object-meta-uni': b'\xd8\xaa'.decode('utf8'), + 'x-object-meta-int': 123, + 'x-object-meta-float': 45.67, + 'x-object-meta-bool': False}) headers = self.conn.head_object(self.containername, self.objectname) self.assertEqual('Something', headers.get('x-object-meta-color')) + self.assertEqual(b'\xd8\xaa'.decode('utf-8'), + headers.get('x-object-meta-uni')) + self.assertEqual('123', headers.get('x-object-meta-int')) + self.assertEqual('45.67', headers.get('x-object-meta-float')) + self.assertEqual('False', headers.get('x-object-meta-bool')) def test_copy_object(self): self.conn.put_object( |