diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-06-14 19:36:45 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-06-14 19:36:45 +0000 |
commit | 07c960d46fe8412d98799b1820d57810a9a8a3e7 (patch) | |
tree | 49e6e9749b187cd912eab658e833f37b4431db26 /tests/unit/test_swiftclient.py | |
parent | c91c8d575e86b480270f8dfb7df49355dd38ee54 (diff) | |
parent | 439330cb9caa88d455ee0770d32ad7bc77db0b2a (diff) | |
download | python-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.py | 31 |
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): |