summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-01-24 01:28:27 +0000
committerGerrit Code Review <review@openstack.org>2017-01-24 01:28:27 +0000
commit9531369c23d1a5106a93148597d18e8558d3f5e5 (patch)
tree21c812e448e54fe04c338611a86a5e3ca79a5062 /tests
parent5ffd496f1f5c7cbbb4bd65803cecd37a6bfb7080 (diff)
parent304da900daccce76d9f54ecd661211674daca591 (diff)
downloadpython-swiftclient-9531369c23d1a5106a93148597d18e8558d3f5e5.tar.gz
Merge "Make functests py3-compatible"
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/test_swiftclient.py35
1 files changed, 20 insertions, 15 deletions
diff --git a/tests/functional/test_swiftclient.py b/tests/functional/test_swiftclient.py
index 7fe9a54..d60ae06 100644
--- a/tests/functional/test_swiftclient.py
+++ b/tests/functional/test_swiftclient.py
@@ -110,15 +110,20 @@ class TestFunctional(unittest.TestCase):
pass
def _check_account_headers(self, headers):
- self.assertTrue(headers.get('content-length'))
- self.assertTrue(headers.get('x-account-object-count'))
- self.assertTrue(headers.get('x-timestamp'))
- self.assertTrue(headers.get('x-trans-id'))
- self.assertTrue(headers.get('date'))
- self.assertTrue(headers.get('x-account-bytes-used'))
- self.assertTrue(headers.get('x-account-container-count'))
- self.assertTrue(headers.get('content-type'))
- self.assertTrue(headers.get('accept-ranges'))
+ headers_to_check = [
+ 'content-length',
+ 'x-account-object-count',
+ 'x-timestamp',
+ 'x-trans-id',
+ 'date',
+ 'x-account-bytes-used',
+ 'x-account-container-count',
+ 'content-type',
+ 'accept-ranges',
+ ]
+ for h in headers_to_check:
+ self.assertIn(h, headers)
+ self.assertTrue(headers[h])
def test_stat_account(self):
headers = self.conn.head_account()
@@ -322,16 +327,16 @@ class TestFunctional(unittest.TestCase):
# verify that put using a generator yielding empty strings does not
# cause connection to be closed
def data():
- yield "should"
- yield ""
- yield " tolerate"
- yield ""
- yield " empty chunks"
+ yield b"should"
+ yield b""
+ yield b" tolerate"
+ yield b""
+ yield b" empty chunks"
self.conn.put_object(
self.containername, self.objectname, data())
hdrs, body = self.conn.get_object(self.containername, self.objectname)
- self.assertEqual("should tolerate empty chunks", body)
+ self.assertEqual(b"should tolerate empty chunks", body)
def test_download_object_retry_chunked(self):
resp_chunk_size = 2