diff options
| author | Kieran Spear <kispear@gmail.com> | 2013-10-24 18:50:36 +1100 |
|---|---|---|
| committer | Kieran Spear <kispear@gmail.com> | 2013-10-24 19:00:35 +1100 |
| commit | e337ae3f639d506a40538d6540ca5cdc4da9db61 (patch) | |
| tree | 097d340df6c648510dbb0d3272f8a006c4e1cefd /ceilometerclient | |
| parent | 1d597e12e7aa0a653d2ffae0a96788ebfbdab59a (diff) | |
| download | python-ceilometerclient-e337ae3f639d506a40538d6540ca5cdc4da9db61.tar.gz | |
Fix cacert argument to HTTPS connection
This fixes a typo that broke the client for HTTPS URLs.
Added a basic test to cover this case.
Coverage is very low in common/http.py.
Change-Id: Ic440f20f463c3b8558a7639f1015096a01496cf8
Closes-bug: 1244091
Diffstat (limited to 'ceilometerclient')
| -rw-r--r-- | ceilometerclient/common/http.py | 2 | ||||
| -rw-r--r-- | ceilometerclient/tests/test_http.py | 21 |
2 files changed, 15 insertions, 8 deletions
diff --git a/ceilometerclient/common/http.py b/ceilometerclient/common/http.py index dd86740..1a4b58c 100644 --- a/ceilometerclient/common/http.py +++ b/ceilometerclient/common/http.py @@ -59,7 +59,7 @@ class HTTPClient(object): if parts.scheme == 'https': _class = VerifiedHTTPSConnection - _kwargs['ca_cert'] = kwargs.get('cacert', None) + _kwargs['cacert'] = kwargs.get('cacert', None) _kwargs['cert_file'] = kwargs.get('cert_file', None) _kwargs['key_file'] = kwargs.get('key_file', None) _kwargs['insecure'] = kwargs.get('insecure', False) diff --git a/ceilometerclient/tests/test_http.py b/ceilometerclient/tests/test_http.py index 602db54..ff85d3e 100644 --- a/ceilometerclient/tests/test_http.py +++ b/ceilometerclient/tests/test_http.py @@ -14,35 +14,42 @@ # under the License. from __future__ import print_function -from ceilometerclient.tests import utils from ceilometerclient.common import http - -fixtures = {} +from ceilometerclient.tests import utils class HttpClientTest(utils.BaseTestCase): + url = 'http://localhost' def test_url_generation_trailing_slash_in_base(self): - client = http.HTTPClient('http://localhost/') + client = http.HTTPClient("%s/" % self.url) url = client._make_connection_url('/v1/resources') print(client.connection_params) self.assertEqual(url, '/v1/resources') def test_url_generation_without_trailing_slash_in_base(self): - client = http.HTTPClient('http://localhost') + client = http.HTTPClient(self.url) url = client._make_connection_url('/v1/resources') print(client.connection_params) self.assertEqual(url, '/v1/resources') def test_url_generation_prefix_slash_in_path(self): - client = http.HTTPClient('http://localhost/') + client = http.HTTPClient("%s/" % self.url) url = client._make_connection_url('/v1/resources') print(client.connection_params) self.assertEqual(url, '/v1/resources') def test_url_generation_without_prefix_slash_in_path(self): - client = http.HTTPClient('http://localhost') + client = http.HTTPClient(self.url) url = client._make_connection_url('v1/resources') print(client.connection_params) self.assertEqual(url, '/v1/resources') + + def test_get_connection(self): + client = http.HTTPClient(self.url) + self.assertIsNotNone(client.get_connection()) + + +class HttpsClientTest(HttpClientTest): + url = 'https://localhost' |
