Add cacert test config option

Change-Id: I3936f862e0fef176cad34f277598b136a40de1eb
This commit is contained in:
Tim Burke 2020-04-13 22:28:53 -07:00
parent a0608f223a
commit 2eba2dd42a
4 changed files with 15 additions and 2 deletions

View File

@ -57,6 +57,11 @@ def _load_config(force_reload=False):
auth_url += 'v1.0'
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')

View File

@ -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

View File

@ -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)

View File

@ -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