Merge "Allow user to be disabled"

This commit is contained in:
Jenkins 2016-02-26 18:18:06 +00:00 committed by Gerrit Code Review
commit 74afe236d3
2 changed files with 9 additions and 5 deletions

View File

@ -38,7 +38,7 @@ class UsersNegativeTest(base.BaseIdentityV3AdminTest):
def test_authentication_for_disabled_user(self):
# Attempt to authenticate for disabled user should fail
self.data.setup_test_user()
self.disable_user(self.data.user['name'])
self.disable_user(self.data.user['name'], self.data.user['domain_id'])
self.assertRaises(lib_exc.Unauthorized, self.token.auth,
username=self.data.user['name'],
password=self.data.user_password,

View File

@ -37,8 +37,12 @@ class BaseIdentityTest(tempest.test.BaseTestCase):
cls.tenants_client.update_tenant(tenant['id'], enabled=False)
@classmethod
def get_user_by_name(cls, name):
users = cls.users_client.list_users()['users']
def get_user_by_name(cls, name, domain_id=None):
if domain_id:
params = {'domain_id': domain_id}
users = cls.users_client.list_users(params)['users']
else:
users = cls.users_client.list_users()['users']
user = [u for u in users if u['name'] == name]
if len(user) > 0:
return user[0]
@ -177,8 +181,8 @@ class BaseIdentityV3AdminTest(BaseIdentityV3Test):
return role[0]
@classmethod
def disable_user(cls, user_name):
user = cls.get_user_by_name(user_name)
def disable_user(cls, user_name, domain_id=None):
user = cls.get_user_by_name(user_name, domain_id)
cls.users_client.update_user(user['id'], user_name, enabled=False)
def delete_domain(self, domain_id):