Merge "Allow user to be disabled"
diff --git a/tempest/api/identity/admin/v3/test_users_negative.py b/tempest/api/identity/admin/v3/test_users_negative.py
index f41ec3d..1375db1 100644
--- a/tempest/api/identity/admin/v3/test_users_negative.py
+++ b/tempest/api/identity/admin/v3/test_users_negative.py
@@ -38,7 +38,7 @@
     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,
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index c44ffb9..849b761 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -37,8 +37,12 @@
         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 @@
             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):