summaryrefslogtreecommitdiff
path: root/tests/unit/test_swiftclient.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-06-14 19:36:45 +0000
committerGerrit Code Review <review@openstack.org>2016-06-14 19:36:45 +0000
commit07c960d46fe8412d98799b1820d57810a9a8a3e7 (patch)
tree49e6e9749b187cd912eab658e833f37b4431db26 /tests/unit/test_swiftclient.py
parentc91c8d575e86b480270f8dfb7df49355dd38ee54 (diff)
parent439330cb9caa88d455ee0770d32ad7bc77db0b2a (diff)
downloadpython-swiftclient-07c960d46fe8412d98799b1820d57810a9a8a3e7.tar.gz
Merge "Query string functionality for containers"
Diffstat (limited to 'tests/unit/test_swiftclient.py')
-rw-r--r--tests/unit/test_swiftclient.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/unit/test_swiftclient.py b/tests/unit/test_swiftclient.py
index cbb95db..4b1c34c 100644
--- a/tests/unit/test_swiftclient.py
+++ b/tests/unit/test_swiftclient.py
@@ -772,6 +772,16 @@ class TestGetContainer(MockHttpTest):
}),
])
+ def test_query_string(self):
+ c.http_connection = self.fake_http_connection(
+ 200, query_string="format=json&hello=20", body=b'[]')
+ c.get_container('http://www.test.com', 'asdf', 'asdf',
+ query_string="hello=20")
+ self.assertRequests([
+ ('GET', '/asdf?format=json&hello=20', '', {
+ 'x-auth-token': 'asdf'}),
+ ])
+
class TestHeadContainer(MockHttpTest):
@@ -831,6 +841,17 @@ class TestPutContainer(MockHttpTest):
'content-length': '0'}),
])
+ def test_query_string(self):
+ c.http_connection = self.fake_http_connection(200,
+ query_string="hello=20")
+ c.put_container('http://www.test.com', 'asdf', 'asdf',
+ query_string="hello=20")
+ for req in self.iter_request_log():
+ self.assertEqual(req['method'], 'PUT')
+ self.assertEqual(req['parsed_path'].path, '/asdf')
+ self.assertEqual(req['parsed_path'].query, 'hello=20')
+ self.assertEqual(req['headers']['x-auth-token'], 'asdf')
+
class TestDeleteContainer(MockHttpTest):
@@ -843,6 +864,16 @@ class TestDeleteContainer(MockHttpTest):
'x-auth-token': 'token'}),
])
+ def test_query_string(self):
+ c.http_connection = self.fake_http_connection(200,
+ query_string="hello=20")
+ c.delete_container('http://www.test.com', 'token', 'container',
+ query_string="hello=20")
+ self.assertRequests([
+ ('DELETE', 'http://www.test.com/container?hello=20', '', {
+ 'x-auth-token': 'token'})
+ ])
+
class TestGetObject(MockHttpTest):