diff options
author | Mahati <mahati.chamarthy@gmail.com> | 2015-09-15 14:34:53 +0530 |
---|---|---|
committer | Mahati <mahati.chamarthy@gmail.com> | 2015-09-16 21:55:56 +0530 |
commit | 7cb99d3157f24e81737463302c937f1c251b7084 (patch) | |
tree | 417cb528bf56f4377916ac214e363a13f21eb400 /tests/unit/test_swiftclient.py | |
parent | 26d29f5ce0a5ae661be478a202e36bf5857d5f83 (diff) | |
download | python-swiftclient-7cb99d3157f24e81737463302c937f1c251b7084.tar.gz |
Add headers parameter
Headers parameter is required when passing client key for encryption.
It is missing for get_container and head_object.
Change-Id: I35c3b266b3c733f6b1629de4c683ea7d40128032
Diffstat (limited to 'tests/unit/test_swiftclient.py')
-rw-r--r-- | tests/unit/test_swiftclient.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/unit/test_swiftclient.py b/tests/unit/test_swiftclient.py index 23b3138..410fd6f 100644 --- a/tests/unit/test_swiftclient.py +++ b/tests/unit/test_swiftclient.py @@ -600,6 +600,20 @@ class TestGetContainer(MockHttpTest): c.get_container('http://www.test.com', 'asdf', 'asdf', path='asdf') + def test_request_headers(self): + c.http_connection = self.fake_http_connection( + 204, query_string="format=json") + conn = c.http_connection('http://www.test.com') + headers = {'x-client-key': 'client key'} + c.get_container('url_is_irrelevant', 'TOKEN', 'container', + http_conn=conn, headers=headers) + self.assertRequests([ + ('GET', '/container?format=json', '', { + 'x-auth-token': 'TOKEN', + 'x-client-key': 'client key', + }), + ]) + class TestHeadContainer(MockHttpTest): @@ -729,6 +743,19 @@ class TestHeadObject(MockHttpTest): self.assertRaises(c.ClientException, c.head_object, 'http://www.test.com', 'asdf', 'asdf', 'asdf') + def test_request_headers(self): + c.http_connection = self.fake_http_connection(204) + conn = c.http_connection('http://www.test.com') + headers = {'x-client-key': 'client key'} + c.head_object('url_is_irrelevant', 'TOKEN', 'container', + 'asdf', http_conn=conn, headers=headers) + self.assertRequests([ + ('HEAD', '/container/asdf', '', { + 'x-auth-token': 'TOKEN', + 'x-client-key': 'client key', + }), + ]) + class TestPutObject(MockHttpTest): |