Merge "Add keystone v3 user negative case test authentication with disabed user"

This commit is contained in:
Jenkins
2015-12-03 06:26:10 +00:00
committed by Gerrit Code Review
2 changed files with 16 additions and 0 deletions

View File

@@ -33,3 +33,14 @@ class UsersNegativeTest(base.BaseIdentityV3AdminTest):
u_name, u_password,
email=u_email,
domain_id=data_utils.rand_uuid_hex())
@test.attr(type=['negative'])
@test.idempotent_id('b3c9fccc-4134-46f5-b600-1da6fb0a3b1f')
def test_authentication_for_disabled_user(self):
# Attempt to authenticate for disabled user should fail
self.data.setup_test_v3_user()
self.disable_user(self.data.test_user)
self.assertRaises(lib_exc.Unauthorized, self.token.auth,
username=self.data.test_user,
password=self.data.test_password,
user_domain_id='default')

View File

@@ -170,6 +170,11 @@ class BaseIdentityV3AdminTest(BaseIdentityV3Test):
if len(role) > 0:
return role[0]
@classmethod
def disable_user(cls, user_name):
user = cls.get_user_by_name(user_name)
cls.client.update_user(user['id'], user_name, enabled=False)
def delete_domain(self, domain_id):
# NOTE(mpavlase) It is necessary to disable the domain before deleting
# otherwise it raises Forbidden exception