Set smoke/gate attributes for tests in "identity"

Change-Id: Ia45bf976c2e59e029687549320b46cba2a803752
Implements: blueprint set-gate-attribute
diff --git a/tempest/tests/identity/admin/test_roles.py b/tempest/tests/identity/admin/test_roles.py
index f71bed0..b3d7921 100644
--- a/tempest/tests/identity/admin/test_roles.py
+++ b/tempest/tests/identity/admin/test_roles.py
@@ -17,6 +17,7 @@
 
 from tempest.common.utils.data_utils import rand_name
 from tempest import exceptions
+from tempest.test import attr
 from tempest.tests.identity import base
 
 
@@ -45,6 +46,7 @@
                 found = True
         self.assertTrue(found, "assigned role was not in list")
 
+    @attr(type='gate')
     def test_list_roles(self):
         # Return a list of all roles
         resp, body = self.client.list_roles()
@@ -52,11 +54,13 @@
         self.assertTrue(any(found))
         self.assertEqual(len(found), len(self.data.roles))
 
+    @attr(type='gate')
     def test_list_roles_by_unauthorized_user(self):
         # Non admin user should not be able to list roles
         self.assertRaises(exceptions.Unauthorized,
                           self.non_admin_client.list_roles)
 
+    @attr(type='gate')
     def test_list_roles_request_without_token(self):
         # Request to list roles without a valid token should fail
         token = self.client.get_auth()
@@ -64,6 +68,7 @@
         self.assertRaises(exceptions.Unauthorized, self.client.list_roles)
         self.client.clear_auth()
 
+    @attr(type='gate')
     def test_role_create_delete(self):
         # Role should be created, verified, and deleted
         role_name = rand_name('role-test-')
@@ -84,10 +89,12 @@
         found = [role for role in body if role['name'] == role_name]
         self.assertFalse(any(found))
 
+    @attr(type='gate')
     def test_role_create_blank_name(self):
         # Should not be able to create a role with a blank name
         self.assertRaises(exceptions.BadRequest, self.client.create_role, '')
 
+    @attr(type='gate')
     def test_role_create_duplicate(self):
         # Role names should be unique
         role_name = rand_name('role-dup-')
@@ -99,6 +106,7 @@
         self.assertRaises(exceptions.Duplicate, self.client.create_role,
                           role_name)
 
+    @attr(type='gate')
     def test_assign_user_role(self):
         # Assign a role to a user on a tenant
         (user, tenant, role) = self._get_role_params()
@@ -106,6 +114,7 @@
         resp, roles = self.client.list_user_roles(tenant['id'], user['id'])
         self.assert_role_in_role_list(role, roles)
 
+    @attr(type='gate')
     def test_assign_user_role_by_unauthorized_user(self):
         # Non admin user should not be authorized to assign a role to user
         (user, tenant, role) = self._get_role_params()
@@ -113,6 +122,7 @@
                           self.non_admin_client.assign_user_role,
                           tenant['id'], user['id'], role['id'])
 
+    @attr(type='gate')
     def test_assign_user_role_request_without_token(self):
         # Request to assign a role to a user without a valid token
         (user, tenant, role) = self._get_role_params()
@@ -123,24 +133,28 @@
                           user['id'], role['id'])
         self.client.clear_auth()
 
+    @attr(type='gate')
     def test_assign_user_role_for_non_existent_user(self):
         # Attempt to assign a role to a non existent user should fail
         (user, tenant, role) = self._get_role_params()
         self.assertRaises(exceptions.NotFound, self.client.assign_user_role,
                           tenant['id'], 'junk-user-id-999', role['id'])
 
+    @attr(type='gate')
     def test_assign_user_role_for_non_existent_role(self):
         # Attempt to assign a non existent role to user should fail
         (user, tenant, role) = self._get_role_params()
         self.assertRaises(exceptions.NotFound, self.client.assign_user_role,
                           tenant['id'], user['id'], 'junk-role-id-12345')
 
+    @attr(type='gate')
     def test_assign_user_role_for_non_existent_tenant(self):
         # Attempt to assign a role on a non existent tenant should fail
         (user, tenant, role) = self._get_role_params()
         self.assertRaises(exceptions.NotFound, self.client.assign_user_role,
                           'junk-tenant-1234', user['id'], role['id'])
 
+    @attr(type='gate')
     def test_assign_duplicate_user_role(self):
         # Duplicate user role should not get assigned
         (user, tenant, role) = self._get_role_params()
@@ -148,6 +162,7 @@
         self.assertRaises(exceptions.Duplicate, self.client.assign_user_role,
                           tenant['id'], user['id'], role['id'])
 
+    @attr(type='gate')
     def test_remove_user_role(self):
         # Remove a role assigned to a user on a tenant
         (user, tenant, role) = self._get_role_params()
@@ -157,6 +172,7 @@
                                                   user_role['id'])
         self.assertEquals(resp['status'], '204')
 
+    @attr(type='gate')
     def test_remove_user_role_by_unauthorized_user(self):
         # Non admin user should not be authorized to remove a user's role
         (user, tenant, role) = self._get_role_params()
@@ -167,6 +183,7 @@
                           self.non_admin_client.remove_user_role,
                           tenant['id'], user['id'], role['id'])
 
+    @attr(type='gate')
     def test_remove_user_role_request_without_token(self):
         # Request to remove a user's role without a valid token
         (user, tenant, role) = self._get_role_params()
@@ -180,6 +197,7 @@
                           user['id'], role['id'])
         self.client.clear_auth()
 
+    @attr(type='gate')
     def test_remove_user_role_non_existant_user(self):
         # Attempt to remove a role from a non existent user should fail
         (user, tenant, role) = self._get_role_params()
@@ -189,6 +207,7 @@
         self.assertRaises(exceptions.NotFound, self.client.remove_user_role,
                           tenant['id'], 'junk-user-id-123', role['id'])
 
+    @attr(type='gate')
     def test_remove_user_role_non_existant_role(self):
         # Attempt to delete a non existent role from a user should fail
         (user, tenant, role) = self._get_role_params()
@@ -198,6 +217,7 @@
         self.assertRaises(exceptions.NotFound, self.client.remove_user_role,
                           tenant['id'], user['id'], 'junk-user-role-123')
 
+    @attr(type='gate')
     def test_remove_user_role_non_existant_tenant(self):
         # Attempt to remove a role from a non existent tenant should fail
         (user, tenant, role) = self._get_role_params()
@@ -207,6 +227,7 @@
         self.assertRaises(exceptions.NotFound, self.client.remove_user_role,
                           'junk-tenant-id-123', user['id'], role['id'])
 
+    @attr(type='gate')
     def test_list_user_roles(self):
         # List roles assigned to a user on tenant
         (user, tenant, role) = self._get_role_params()
@@ -214,6 +235,7 @@
         resp, roles = self.client.list_user_roles(tenant['id'], user['id'])
         self.assert_role_in_role_list(role, roles)
 
+    @attr(type='gate')
     def test_list_user_roles_by_unauthorized_user(self):
         # Non admin user should not be authorized to list a user's roles
         (user, tenant, role) = self._get_role_params()
@@ -222,6 +244,7 @@
                           self.non_admin_client.list_user_roles, tenant['id'],
                           user['id'])
 
+    @attr(type='gate')
     def test_list_user_roles_request_without_token(self):
         # Request to list user's roles without a valid token should fail
         (user, tenant, role) = self._get_role_params()
@@ -234,6 +257,7 @@
         finally:
             self.client.clear_auth()
 
+    @attr(type='gate')
     def test_list_user_roles_for_non_existent_user(self):
         # Attempt to list roles of a non existent user should fail
         (user, tenant, role) = self._get_role_params()
diff --git a/tempest/tests/identity/admin/test_services.py b/tempest/tests/identity/admin/test_services.py
index 35b2463..6d8700f 100644
--- a/tempest/tests/identity/admin/test_services.py
+++ b/tempest/tests/identity/admin/test_services.py
@@ -18,12 +18,14 @@
 
 from tempest.common.utils.data_utils import rand_name
 from tempest import exceptions
+from tempest.test import attr
 from tempest.tests.identity import base
 
 
 class ServicesTestJSON(base.BaseIdentityAdminTest):
     _interface = 'json'
 
+    @attr(type='smoke')
     def test_create_get_delete_service(self):
         # GET Service
         try:
@@ -65,6 +67,7 @@
                 self.assertRaises(exceptions.NotFound, self.client.get_service,
                                   service_data['id'])
 
+    @attr(type='smoke')
     def test_list_services(self):
         # Create, List, Verify and Delete Services
         services = []
diff --git a/tempest/tests/identity/admin/test_tenants.py b/tempest/tests/identity/admin/test_tenants.py
index 8155eb5..c51a14a 100644
--- a/tempest/tests/identity/admin/test_tenants.py
+++ b/tempest/tests/identity/admin/test_tenants.py
@@ -24,11 +24,13 @@
 class TenantsTestJSON(base.BaseIdentityAdminTest):
     _interface = 'json'
 
+    @attr(type='gate')
     def test_list_tenants_by_unauthorized_user(self):
         # Non-admin user should not be able to list tenants
         self.assertRaises(exceptions.Unauthorized,
                           self.non_admin_client.list_tenants)
 
+    @attr(type='gate')
     def test_list_tenant_request_without_token(self):
         # Request to list tenants without a valid token should fail
         token = self.client.get_auth()
@@ -36,6 +38,7 @@
         self.assertRaises(exceptions.Unauthorized, self.client.list_tenants)
         self.client.clear_auth()
 
+    @attr(type='gate')
     def test_tenant_list_delete(self):
         # Create several tenants and delete them
         tenants = []
@@ -58,7 +61,7 @@
         found = [tenant for tenant in body if tenant['id'] in tenant_ids]
         self.assertFalse(any(found), 'Tenants failed to delete')
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_tenant_delete_by_unauthorized_user(self):
         # Non-admin user should not be able to delete a tenant
         tenant_name = rand_name('tenant-')
@@ -67,7 +70,7 @@
         self.assertRaises(exceptions.Unauthorized,
                           self.non_admin_client.delete_tenant, tenant['id'])
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_tenant_delete_request_without_token(self):
         # Request to delete a tenant without a valid token should fail
         tenant_name = rand_name('tenant-')
@@ -79,7 +82,7 @@
                           tenant['id'])
         self.client.clear_auth()
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_delete_non_existent_tenant(self):
         # Attempt to delete a non existent tenant should fail
         self.assertRaises(exceptions.NotFound, self.client.delete_tenant,
@@ -142,7 +145,7 @@
         self.client.delete_tenant(tenant_id)
         self.data.tenants.remove(tenant)
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_tenant_create_duplicate(self):
         # Tenant names should be unique
         tenant_name = rand_name('tenant-dup-')
@@ -156,14 +159,14 @@
         self.assertRaises(exceptions.Duplicate, self.client.create_tenant,
                           tenant_name)
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_create_tenant_by_unauthorized_user(self):
         # Non-admin user should not be authorized to create a tenant
         tenant_name = rand_name('tenant-')
         self.assertRaises(exceptions.Unauthorized,
                           self.non_admin_client.create_tenant, tenant_name)
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_create_tenant_request_without_token(self):
         # Create tenant request without a token should not be authorized
         tenant_name = rand_name('tenant-')
@@ -173,7 +176,7 @@
                           tenant_name)
         self.client.clear_auth()
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_create_tenant_with_empty_name(self):
         # Tenant name should not be empty
         self.assertRaises(exceptions.BadRequest, self.client.create_tenant,
diff --git a/tempest/tests/identity/admin/test_users.py b/tempest/tests/identity/admin/test_users.py
index f9772ac..e638a08 100644
--- a/tempest/tests/identity/admin/test_users.py
+++ b/tempest/tests/identity/admin/test_users.py
@@ -32,7 +32,7 @@
     alt_tenant = rand_name('test_tenant_')
     alt_description = rand_name('desc_')
 
-    @attr(type='smoke')
+    @attr(type=['smoke', 'gate'])
     def test_create_user(self):
         # Create a user
         self.data.setup_test_tenant()
@@ -43,7 +43,7 @@
         self.assertEqual('200', resp['status'])
         self.assertEqual(self.alt_user, user['name'])
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_create_user_by_unauthorized_user(self):
         # Non-admin should not be authorized to create a user
         self.data.setup_test_tenant()
@@ -52,7 +52,7 @@
                           self.alt_password, self.data.tenant['id'],
                           self.alt_email)
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_create_user_with_empty_name(self):
         # User with an empty name should not be created
         self.data.setup_test_tenant()
@@ -60,7 +60,7 @@
                           self.alt_password, self.data.tenant['id'],
                           self.alt_email)
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_create_user_with_name_length_over_64(self):
         # Length of user name filed should be restricted to 64 characters
         self.data.setup_test_tenant()
@@ -68,7 +68,7 @@
                           'a' * 65, self.alt_password,
                           self.data.tenant['id'], self.alt_email)
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_create_user_with_duplicate_name(self):
         # Duplicate user should not be created
         self.data.setup_test_user()
@@ -76,7 +76,7 @@
                           self.data.test_user, self.data.test_password,
                           self.data.tenant['id'], self.data.test_email)
 
-    @attr(type='negative')
+    @attr(type='gate')
     @testtools.skip("Until Bug #999084 is fixed")
     def test_create_user_with_empty_password(self):
         # User with an empty password should not be created
@@ -85,7 +85,7 @@
                           self.alt_user, '', self.data.tenant['id'],
                           self.alt_email)
 
-    @attr(type='nagative')
+    @attr(type='gate')
     @testtools.skip("Until Bug #999084 is fixed")
     def test_create_user_with_long_password(self):
         # User having password exceeding max length should not be created
@@ -94,7 +94,7 @@
                           self.alt_user, 'a' * 65, self.data.tenant['id'],
                           self.alt_email)
 
-    @attr(type='negative')
+    @attr(type='gate')
     @testtools.skip("Until Bug #999084 is fixed")
     def test_create_user_with_invalid_email_format(self):
         # Email format should be validated while creating a user
@@ -102,14 +102,14 @@
         self.assertRaises(exceptions.BadRequest, self.client.create_user,
                           self.alt_user, '', self.data.tenant['id'], '12345')
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_create_user_for_non_existant_tenant(self):
         # Attempt to create a user in a non-existent tenant should fail
         self.assertRaises(exceptions.NotFound, self.client.create_user,
                           self.alt_user, self.alt_password, '49ffgg99999',
                           self.alt_email)
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_create_user_request_without_a_token(self):
         # Request to create a user without a valid token should fail
         self.data.setup_test_tenant()
@@ -124,7 +124,7 @@
         # Unset the token to allow further tests to generate a new token
         self.client.clear_auth()
 
-    @attr(type='smoke')
+    @attr(type=['smoke', 'gate'])
     def test_delete_user(self):
         # Delete a user
         self.data.setup_test_tenant()
@@ -135,7 +135,7 @@
         resp, body = self.client.delete_user(user['id'])
         self.assertEquals('204', resp['status'])
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_delete_users_by_unauthorized_user(self):
         # Non admin user should not be authorized to delete a user
         self.data.setup_test_user()
@@ -143,13 +143,13 @@
                           self.non_admin_client.delete_user,
                           self.data.user['id'])
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_delete_non_existant_user(self):
         # Attempt to delete a non-existent user should fail
         self.assertRaises(exceptions.NotFound, self.client.delete_user,
                           'junk12345123')
 
-    @attr(type='smoke')
+    @attr(type=['smoke', 'gate'])
     def test_user_authentication(self):
         # Valid user's token is authenticated
         self.data.setup_test_user()
@@ -162,7 +162,7 @@
                                             self.data.test_tenant)
         self.assertEqual('200', resp['status'])
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_authentication_for_disabled_user(self):
         # Disabled user's token should not get authenticated
         self.data.setup_test_user()
@@ -172,7 +172,7 @@
                           self.data.test_password,
                           self.data.test_tenant)
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_authentication_when_tenant_is_disabled(self):
         # User's token for a disabled tenant should not be authenticated
         self.data.setup_test_user()
@@ -182,7 +182,7 @@
                           self.data.test_password,
                           self.data.test_tenant)
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_authentication_with_invalid_tenant(self):
         # User's token for an invalid tenant should not be authenticated
         self.data.setup_test_user()
@@ -191,7 +191,7 @@
                           self.data.test_password,
                           'junktenant1234')
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_authentication_with_invalid_username(self):
         # Non-existent user's token should not get authenticated
         self.data.setup_test_user()
@@ -199,7 +199,7 @@
                           'junkuser123', self.data.test_password,
                           self.data.test_tenant)
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_authentication_with_invalid_password(self):
         # User's token with invalid password should not be authenticated
         self.data.setup_test_user()
@@ -207,7 +207,7 @@
                           self.data.test_user, 'junkpass1234',
                           self.data.test_tenant)
 
-    @attr(type='positive')
+    @attr(type='gate')
     def test_authentication_request_without_token(self):
         # Request for token authentication with a valid token in header
         self.data.setup_test_user()
@@ -224,7 +224,7 @@
         self.assertEqual('200', resp['status'])
         self.client.clear_auth()
 
-    @attr(type='smoke')
+    @attr(type=['smoke', 'gate'])
     def test_get_users(self):
         # Get a list of users and find the test user
         self.data.setup_test_user()
@@ -233,14 +233,14 @@
                         Contains(self.data.test_user),
                         "Could not find %s" % self.data.test_user)
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_get_users_by_unauthorized_user(self):
         # Non admin user should not be authorized to get user list
         self.data.setup_test_user()
         self.assertRaises(exceptions.Unauthorized,
                           self.non_admin_client.get_users)
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_get_users_request_without_token(self):
         # Request to get list of users without a valid token should fail
         token = self.client.get_auth()
@@ -248,7 +248,7 @@
         self.assertRaises(exceptions.Unauthorized, self.client.get_users)
         self.client.clear_auth()
 
-    @attr(type='positive')
+    @attr(type='gate')
     def test_list_users_for_tenant(self):
         # Return a list of all users for a tenant
         self.data.setup_test_tenant()
@@ -278,7 +278,7 @@
                          "Failed to find user %s in fetched list" %
                          ', '.join(m_user for m_user in missing_users))
 
-    @attr(type='positive')
+    @attr(type='gate')
     def test_list_users_with_roles_for_tenant(self):
         # Return list of users on tenant when roles are assigned to users
         self.data.setup_test_user()
@@ -315,7 +315,7 @@
                          "Failed to find user %s in fetched list" %
                          ', '.join(m_user for m_user in missing_users))
 
-    @attr(type='negative')
+    @attr(type='gate')
     def test_list_users_with_invalid_tenant(self):
         # Should not be able to return a list of all
         # users for a nonexistant tenant
diff --git a/tempest/tests/identity/admin/v3/test_endpoints.py b/tempest/tests/identity/admin/v3/test_endpoints.py
index 3ad9b28..535fc92 100755
--- a/tempest/tests/identity/admin/v3/test_endpoints.py
+++ b/tempest/tests/identity/admin/v3/test_endpoints.py
@@ -54,7 +54,7 @@
         for s in cls.service_ids:
             cls.identity_client.delete_service(s)
 
-    @attr('positive')
+    @attr(type='gate')
     def test_list_endpoints(self):
         # Get a list of endpoints
         resp, fetched_endpoints = self.client.list_endpoints()
@@ -66,7 +66,7 @@
                          "Failed to find endpoint %s in fetched list" %
                          ', '.join(str(e) for e in missing_endpoints))
 
-    @attr('positive')
+    @attr(type='gate')
     def test_create_delete_endpoint(self):
         region = rand_name('region')
         url = rand_name('url')
@@ -106,7 +106,7 @@
                 if matched:
                     self.fail("Delete endpoint is not successful")
 
-    @attr('smoke')
+    @attr(type='smoke')
     def test_update_endpoint(self):
         #Creating an endpoint so as to check update endpoint
         #with new values
diff --git a/tempest/tests/identity/admin/v3/test_services.py b/tempest/tests/identity/admin/v3/test_services.py
index fef3bca..e85c6c0 100644
--- a/tempest/tests/identity/admin/v3/test_services.py
+++ b/tempest/tests/identity/admin/v3/test_services.py
@@ -17,12 +17,14 @@
 
 
 from tempest.common.utils.data_utils import rand_name
+from tempest.test import attr
 from tempest.tests.identity import base
 
 
 class ServicesTestJSON(base.BaseIdentityAdminTest):
     _interface = 'json'
 
+    @attr(type='gate')
     def test_update_service(self):
         # Update description attribute of service
         name = rand_name('service-')
diff --git a/tempest/tests/identity/admin/v3/test_users.py b/tempest/tests/identity/admin/v3/test_users.py
index 39b8ca1..d88cf2e 100644
--- a/tempest/tests/identity/admin/v3/test_users.py
+++ b/tempest/tests/identity/admin/v3/test_users.py
@@ -23,7 +23,7 @@
 class UsersV3TestJSON(base.BaseIdentityAdminTest):
     _interface = 'json'
 
-    @attr('smoke')
+    @attr(type='gate')
     def test_user_update(self):
         # Test case to check if updating of user attributes is successful.
         #Creating first user
@@ -67,7 +67,7 @@
         self.assertEqual(u_email2, new_user_get['email'])
         self.assertEqual('false', str(new_user_get['enabled']).lower())
 
-    @attr('smoke')
+    @attr(type='gate')
     def test_list_user_projects(self):
         #List the projects that a user has access upon
         assigned_project_ids = list()