summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-08-31 00:58:02 +0000
committerGerrit Code Review <review@openstack.org>2016-08-31 00:58:02 +0000
commit98085c961fc9421ffb07e62dacee67da9b7fcd16 (patch)
tree22244770ee6b32ac00eeef7d51f2e6278ea56f36 /tests
parent39b9db35a0fb4db988725b68c129cb45cbb5f733 (diff)
parentab60e08e2e34ac4a87bc6c1701c6ace69bb392cf (diff)
downloadpython-swiftclient-98085c961fc9421ffb07e62dacee67da9b7fcd16.tar.gz
Merge "Convert numeric and boolean header values to strings"
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/test_swiftclient.py11
-rw-r--r--tests/unit/test_swiftclient.py7
2 files changed, 14 insertions, 4 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(
diff --git a/tests/unit/test_swiftclient.py b/tests/unit/test_swiftclient.py
index 0095447..7e753e9 100644
--- a/tests/unit/test_swiftclient.py
+++ b/tests/unit/test_swiftclient.py
@@ -185,9 +185,9 @@ class TestHttpHelpers(MockHttpTest):
def test_encode_meta_headers(self):
headers = {'abc': '123',
- u'x-container-meta-\u0394': '123',
- u'x-account-meta-\u0394': '123',
- u'x-object-meta-\u0394': '123'}
+ u'x-container-meta-\u0394': 123,
+ u'x-account-meta-\u0394': 12.3,
+ u'x-object-meta-\u0394': True}
r = swiftclient.encode_meta_headers(headers)
@@ -199,6 +199,7 @@ class TestHttpHelpers(MockHttpTest):
for k, v in r.items():
self.assertIs(type(k), binary_type)
self.assertIs(type(v), binary_type)
+ self.assertIn(v, (b'123', b'12.3', b'True'))
def test_set_user_agent_default(self):
_junk, conn = c.http_connection('http://www.example.com')