Merge "Add cacert test config option"

This commit is contained in:
Zuul 2020-09-23 22:14:55 +00:00 committed by Gerrit Code Review
commit 89994a7ad0
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

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