Object storage tests to use default auth_provider
Object storage test uses get_auth_provider(), it should just take the existing auth_provider instead. Partially implements: bp multi-keystone-api-version-tests Change-Id: I790c22becb28ef8c2946efcc4b1c47f8e295fb74
This commit is contained in:
parent
9f7e7e0596
commit
3099ffb85d
|
@ -68,7 +68,7 @@ class AccountQuotasTest(base.BaseObjectTest):
|
|||
# Retrieve a ResellerAdmin auth data and use it to set a quota
|
||||
# on the client's account
|
||||
cls.reselleradmin_auth_data = \
|
||||
cls.os_reselleradmin.get_auth_provider().auth_data
|
||||
cls.os_reselleradmin.auth_provider.auth_data
|
||||
|
||||
def setUp(self):
|
||||
super(AccountQuotasTest, self).setUp()
|
||||
|
|
|
@ -68,7 +68,7 @@ class AccountQuotasNegativeTest(base.BaseObjectTest):
|
|||
# Retrieve a ResellerAdmin auth data and use it to set a quota
|
||||
# on the client's account
|
||||
cls.reselleradmin_auth_data = \
|
||||
cls.os_reselleradmin.get_auth_provider().auth_data
|
||||
cls.os_reselleradmin.auth_provider.auth_data
|
||||
|
||||
def setUp(self):
|
||||
super(AccountQuotasNegativeTest, self).setUp()
|
||||
|
|
|
@ -31,7 +31,7 @@ class AccountNegativeTest(base.BaseObjectTest):
|
|||
test_os = clients.Manager(self.data.test_user,
|
||||
self.data.test_password,
|
||||
self.data.test_tenant)
|
||||
test_auth_provider = test_os.get_auth_provider()
|
||||
test_auth_provider = test_os.auth_provider
|
||||
# Get auth for the test user
|
||||
test_auth_provider.auth_data
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class ObjectTestACLs(base.BaseObjectTest):
|
|||
test_os = clients.Manager(cls.data.test_user,
|
||||
cls.data.test_password,
|
||||
cls.data.test_tenant)
|
||||
cls.test_auth_data = test_os.get_auth_provider().auth_data
|
||||
cls.test_auth_data = test_os.auth_provider.auth_data
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
|
|
@ -29,7 +29,7 @@ class ObjectACLsNegativeTest(base.BaseObjectTest):
|
|||
test_os = clients.Manager(cls.data.test_user,
|
||||
cls.data.test_password,
|
||||
cls.data.test_tenant)
|
||||
cls.test_auth_data = test_os.get_auth_provider().auth_data
|
||||
cls.test_auth_data = test_os.auth_provider.auth_data
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
|
|
|
@ -20,6 +20,10 @@ class InvalidConfiguration(base.TempestException):
|
|||
message = "Invalid Configuration"
|
||||
|
||||
|
||||
class InvalidCredentials(base.TempestException):
|
||||
message = "Invalid Credentials"
|
||||
|
||||
|
||||
class InvalidHttpSuccessCode(base.RestClientException):
|
||||
message = "The success code is different than the expected one"
|
||||
|
||||
|
|
|
@ -75,13 +75,12 @@ class Manager(object):
|
|||
tenant_name=CONF.identity.tenant_name
|
||||
)
|
||||
|
||||
def get_auth_provider(self, credentials=None):
|
||||
auth_params = dict(client_type=getattr(self, 'client_type', None),
|
||||
interface=getattr(self, 'interface', None))
|
||||
def get_auth_provider(self, credentials):
|
||||
if credentials is None:
|
||||
raise exceptions.InvalidCredentials(
|
||||
'Credentials must be specified')
|
||||
auth_provider_class = self.get_auth_provider_class(self.auth_version)
|
||||
# If invalid / incomplete credentials are provided, use default ones
|
||||
if credentials is None or \
|
||||
not auth_provider_class.check_credentials(credentials):
|
||||
credentials = self.credentials
|
||||
auth_params['credentials'] = credentials
|
||||
return auth_provider_class(**auth_params)
|
||||
return auth_provider_class(
|
||||
client_type=getattr(self, 'client_type', None),
|
||||
interface=getattr(self, 'interface', None),
|
||||
credentials=credentials)
|
||||
|
|
Loading…
Reference in New Issue