diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-02-29 16:26:58 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-02-29 16:26:58 +0000 |
commit | b040ce4e1a330970516c23452bb8d2ac52c9ac19 (patch) | |
tree | 7fbadfd751892a58295b6774fbf7eabb262c0e88 /tests/unit/test_swiftclient.py | |
parent | 9460a946246437845330a8f376a51af7ce6eb4e8 (diff) | |
parent | 67f5468ee485ac3480530df1e59f8f7f92071f66 (diff) | |
download | python-swiftclient-b040ce4e1a330970516c23452bb8d2ac52c9ac19.tar.gz |
Merge "Fix wrong args for get_container with full listing"
Diffstat (limited to 'tests/unit/test_swiftclient.py')
-rw-r--r-- | tests/unit/test_swiftclient.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/unit/test_swiftclient.py b/tests/unit/test_swiftclient.py index c3074fe..5b03831 100644 --- a/tests/unit/test_swiftclient.py +++ b/tests/unit/test_swiftclient.py @@ -2462,6 +2462,28 @@ class TestServiceToken(MockHttpTest): actual['full_path']) self.assertEqual(conn.attempts, 1) + def test_service_token_get_container_full_listing(self): + # verify service token is sent with each request for a full listing + with mock.patch('swiftclient.client.http_connection', + self.fake_http_connection(200, 200)): + with mock.patch('swiftclient.client.parse_api_response') as resp: + resp.side_effect = ([{"name": "obj1"}], []) + conn = self.get_connection() + conn.get_container('container1', full_listing=True) + self.assertEqual(2, len(self.request_log), self.request_log) + expected_urls = iter(( + 'http://storage_url.com/container1?format=json', + 'http://storage_url.com/container1?format=json&marker=obj1' + )) + for actual in self.iter_request_log(): + self.assertEqual('GET', actual['method']) + actual_hdrs = actual['headers'] + self.assertEqual('stoken', actual_hdrs.get('X-Service-Token')) + self.assertEqual('token', actual_hdrs['X-Auth-Token']) + self.assertEqual(next(expected_urls), + actual['full_path']) + self.assertEqual(conn.attempts, 1) + def test_service_token_head_container(self): with mock.patch('swiftclient.client.http_connection', self.fake_http_connection(200)): |