Allow non-default domain to be used in func tests

Change-Id: I7afa7e367103bb9caaf74788a49cd055eca53cf6
This commit is contained in:
Tim Burke 2019-08-05 14:48:54 -07:00
parent 2e4c8a924e
commit a48dd1950d
2 changed files with 17 additions and 1 deletions

View File

@ -918,12 +918,18 @@ def setup_package():
swift_test_user[0] = config['username']
swift_test_tenant[0] = config['account']
swift_test_key[0] = config['password']
if 'domain' in config:
swift_test_domain[0] = config['domain']
swift_test_user[1] = config['username2']
swift_test_tenant[1] = config['account2']
swift_test_key[1] = config['password2']
if 'domain2' in config:
swift_test_domain[1] = config['domain2']
swift_test_user[2] = config['username3']
swift_test_tenant[2] = config['account']
swift_test_key[2] = config['password3']
if 'domain3' in config:
swift_test_domain[2] = config['domain3']
if 'username4' in config:
swift_test_user[3] = config['username4']
swift_test_tenant[3] = config['account4']
@ -933,10 +939,14 @@ def setup_package():
swift_test_user[4] = config['username5']
swift_test_tenant[4] = config['account5']
swift_test_key[4] = config['password5']
if 'domain5' in config:
swift_test_domain[4] = config['domain5']
if 'username6' in config:
swift_test_user[5] = config['username6']
swift_test_tenant[5] = config['account6']
swift_test_key[5] = config['password6']
if 'domain6' in config:
swift_test_domain[5] = config['domain6']
for _ in range(5):
swift_test_perm[_] = swift_test_tenant[_] + ':' \

View File

@ -208,6 +208,7 @@ class Connection(object):
self.insecure = config_true_value(config.get('insecure', 'false'))
self.auth_version = str(config.get('auth_version', '1'))
self.domain = config.get('domain')
self.account = config.get('account')
self.username = config['username']
self.password = config['password']
@ -269,8 +270,13 @@ class Connection(object):
else:
requests.packages.urllib3.disable_warnings(
InsecureRequestWarning)
if self.domain:
os_opts = {'project_domain_name': self.domain,
'user_domain_name': self.domain}
else:
os_opts = {}
authargs = dict(snet=False, tenant_name=self.account,
auth_version=self.auth_version, os_options={},
auth_version=self.auth_version, os_options=os_opts,
insecure=self.insecure)
(storage_url, storage_token) = get_auth(
self.auth_url, auth_user, self.password, **authargs)