diff options
-rw-r--r-- | test/functional/__init__.py | 5 | ||||
-rw-r--r-- | test/functional/test_openstacksdk.py | 1 | ||||
-rw-r--r-- | test/functional/test_swiftclient.py | 6 | ||||
-rw-r--r-- | test/sample.conf | 5 |
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 49bca90..04dfdd9 100644 --- a/test/sample.conf +++ b/test/sample.conf @@ -6,6 +6,11 @@ auth_uri = http://127.0.0.1:8080/auth/v1.0/ #auth_version = 2 #auth_uri = http://localhost:5000/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 |