diff options
author | Cedric Brandily <zzelle@gmail.com> | 2016-04-10 23:18:17 +0200 |
---|---|---|
committer | Cedric Brandily <zzelle@gmail.com> | 2016-04-10 23:20:49 +0200 |
commit | 450f505c35f8762cca29d56b6e928490288ec166 (patch) | |
tree | 367b0d9a84f991053395d77ce965e9367e0136d5 /tests/unit/utils.py | |
parent | 015903e383a27318918ee7827574ecb120110ae2 (diff) | |
download | python-swiftclient-450f505c35f8762cca29d56b6e928490288ec166.tar.gz |
Support client certificate/key
This change enables to specify a client certificate/key with:
* usual CLI options (--os-cert/--os-key)
* usual environment variables ($OS_CERT/$OS_KEY)
Closes-Bug: #1565112
Change-Id: I12e151adcb6084d801c6dfed21d82232a3259aea
Diffstat (limited to 'tests/unit/utils.py')
-rw-r--r-- | tests/unit/utils.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/unit/utils.py b/tests/unit/utils.py index 3b043bc..d04583f 100644 --- a/tests/unit/utils.py +++ b/tests/unit/utils.py @@ -57,6 +57,11 @@ def fake_get_auth_keystone(expected_os_options=None, exc=None, actual_kwargs['cacert'] is None: from swiftclient import client as c raise c.ClientException("unverified-certificate") + if auth_url.startswith("https") and \ + auth_url.endswith("client-certificate") and \ + not (actual_kwargs['cert'] and actual_kwargs['cert_key']): + from swiftclient import client as c + raise c.ClientException("noclient-certificate") return storage_url, token return fake_get_auth_keystone @@ -215,6 +220,7 @@ class MockHttpTest(unittest.TestCase): on_request = kwargs.get('on_request') def wrapper(url, proxy=None, cacert=None, insecure=False, + cert=None, cert_key=None, ssl_compression=True, timeout=None): if storage_url: self.assertEqual(storage_url, url) |