summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2020-04-13 22:28:53 -0700
committerTim Burke <tim.burke@gmail.com>2020-04-13 22:29:44 -0700
commit2eba2dd42a7fa9663b59486f25707c16ef3731d7 (patch)
treed6961146d286acea115cd6d46d83a83848dc0d8c
parenta0608f223a70169655d073b296374e6c8cf180fa (diff)
downloadpython-swiftclient-2eba2dd42a7fa9663b59486f25707c16ef3731d7.tar.gz
Add cacert test config option
Change-Id: I3936f862e0fef176cad34f277598b136a40de1eb
-rw-r--r--test/functional/__init__.py5
-rw-r--r--test/functional/test_openstacksdk.py1
-rw-r--r--test/functional/test_swiftclient.py6
-rw-r--r--test/sample.conf5
4 files changed, 15 insertions, 2 deletions
diff --git a/test/functional/__init__.py b/test/functional/__init__.py
index 248875a..f0fea3b 100644
--- a/test/functional/__init__.py
+++ b/test/functional/__init__.py
@@ -58,6 +58,11 @@ def _load_config(force_reload=False):
conf['auth_url'] = auth_url
try:
+ conf['cacert'] = parser.get('func_test', 'cacert')
+ except configparser.NoOptionError:
+ conf['cacert'] = None
+
+ try:
conf['account_username'] = parser.get('func_test',
'account_username')
except configparser.NoOptionError:
diff --git a/test/functional/test_openstacksdk.py b/test/functional/test_openstacksdk.py
index cee7f4e..e51773a 100644
--- a/test/functional/test_openstacksdk.py
+++ b/test/functional/test_openstacksdk.py
@@ -35,6 +35,7 @@ class TestOpenStackSDK(unittest.TestCase):
auth_url=TEST_CONFIG['auth_url'],
username=TEST_CONFIG['account_username'],
password=TEST_CONFIG['password'],
+ cacert=TEST_CONFIG['cacert'],
)
cls.object_store = cls.conn.object_store
diff --git a/test/functional/test_swiftclient.py b/test/functional/test_swiftclient.py
index 54c514d..aaade87 100644
--- a/test/functional/test_swiftclient.py
+++ b/test/functional/test_swiftclient.py
@@ -42,6 +42,7 @@ class TestFunctional(unittest.TestCase):
def _get_config(self):
self.auth_url = TEST_CONFIG['auth_url']
+ self.cacert = TEST_CONFIG['cacert']
self.auth_version = TEST_CONFIG['auth_version']
self.account_username = TEST_CONFIG['account_username']
self.password = TEST_CONFIG['password']
@@ -52,7 +53,7 @@ class TestFunctional(unittest.TestCase):
"""
return swiftclient.Connection(
self.auth_url, self.account_username, self.password,
- auth_version=self.auth_version)
+ auth_version=self.auth_version, cacert=self.cacert)
def setUp(self):
super(TestFunctional, self).setUp()
@@ -486,7 +487,7 @@ class TestUsingKeystone(TestFunctional):
return swiftclient.Connection(
self.auth_url, username, self.password,
- auth_version=self.auth_version,
+ auth_version=self.auth_version, cacert=self.cacert,
os_options={'tenant_name': account})
@@ -515,4 +516,5 @@ class TestUsingKeystoneV3(TestFunctional):
'user_domain_name': user_domain}
return swiftclient.Connection(self.auth_url, username, password,
auth_version=self.auth_version,
+ cacert=self.cacert,
os_options=os_options)
diff --git a/test/sample.conf b/test/sample.conf
index 95c1a47..2b19de4 100644
--- a/test/sample.conf
+++ b/test/sample.conf
@@ -12,6 +12,11 @@ auth_prefix = /auth/
#auth_ssl = no
#auth_prefix = /v2.0/
+# You may want to run tests against endpoints that use development certs
+# without installing the CA system-wide. Use this to trust an extra set
+# of certificates.
+#cacert = /path/to/trusted-ca.crt
+
# Primary functional test account (needs admin access to the account).
# By default the tests use a swiftclient.client.Connection instance with user
# attribute set to 'account:username' based on the options 'account' and