Merge "Refactor test_roles_client"
diff --git a/tempest/api/compute/admin/test_baremetal_nodes.py b/tempest/api/compute/admin/test_baremetal_nodes.py
index 722d9a6..b18363f 100644
--- a/tempest/api/compute/admin/test_baremetal_nodes.py
+++ b/tempest/api/compute/admin/test_baremetal_nodes.py
@@ -36,7 +36,7 @@
def test_list_get_baremetal_nodes(self):
# Create some test nodes in Ironic directly
test_nodes = []
- for i in range(0, 3):
+ for _ in range(0, 3):
_, node = self.ironic_client.create_node()
test_nodes.append(node)
self.addCleanup(self.ironic_client.delete_node, node['uuid'])
diff --git a/tempest/api/compute/admin/test_keypairs_v210.py b/tempest/api/compute/admin/test_keypairs_v210.py
index 9011433..5146f72 100644
--- a/tempest/api/compute/admin/test_keypairs_v210.py
+++ b/tempest/api/compute/admin/test_keypairs_v210.py
@@ -30,7 +30,7 @@
def _create_and_check_keypairs(self, user_id):
key_list = list()
- for i in range(2):
+ for _ in range(2):
k_name = data_utils.rand_name('keypair')
keypair = self.create_keypair(k_name,
keypair_type='ssh',
diff --git a/tempest/api/compute/admin/test_security_groups.py b/tempest/api/compute/admin/test_security_groups.py
index e329869..5e4c639 100644
--- a/tempest/api/compute/admin/test_security_groups.py
+++ b/tempest/api/compute/admin/test_security_groups.py
@@ -39,7 +39,7 @@
# List of all security groups created
security_group_list = []
# Create two security groups for a non-admin tenant
- for i in range(2):
+ for _ in range(2):
name = data_utils.rand_name('securitygroup')
description = data_utils.rand_name('description')
securitygroup = self.client.create_security_group(
@@ -50,7 +50,7 @@
client_tenant_id = securitygroup['tenant_id']
# Create two security groups for admin tenant
- for i in range(2):
+ for _ in range(2):
name = data_utils.rand_name('securitygroup')
description = data_utils.rand_name('description')
adm_securitygroup = self.adm_client.create_security_group(
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips.py b/tempest/api/compute/floating_ips/test_list_floating_ips.py
index 222bf18..5617e8a 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips.py
@@ -33,7 +33,7 @@
super(FloatingIPDetailsTestJSON, cls).resource_setup()
cls.floating_ip = []
cls.floating_ip_id = []
- for i in range(3):
+ for _ in range(3):
body = cls.client.create_floating_ip(
pool=CONF.network.floating_network_name)['floating_ip']
cls.floating_ip.append(body)
diff --git a/tempest/api/compute/keypairs/test_keypairs.py b/tempest/api/compute/keypairs/test_keypairs.py
index 8acc25a..30222f4 100644
--- a/tempest/api/compute/keypairs/test_keypairs.py
+++ b/tempest/api/compute/keypairs/test_keypairs.py
@@ -26,7 +26,7 @@
# Keypairs created should be available in the response list
# Create 3 keypairs
key_list = list()
- for i in range(3):
+ for _ in range(3):
keypair = self.create_keypair()
# Need to pop these keys so that our compare doesn't fail later,
# as the keypair dicts from list API doesn't have them.
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index 4184afa..b667898 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -34,7 +34,7 @@
# Positive test:Should return the list of Security Groups
# Create 3 Security Groups
security_group_list = []
- for i in range(3):
+ for _ in range(3):
body = self.create_security_group()
security_group_list.append(body)
# Fetch all Security Groups and verify the list
diff --git a/tempest/api/compute/servers/test_list_servers_negative.py b/tempest/api/compute/servers/test_list_servers_negative.py
index 3e408d2..8ba8941 100644
--- a/tempest/api/compute/servers/test_list_servers_negative.py
+++ b/tempest/api/compute/servers/test_list_servers_negative.py
@@ -36,7 +36,7 @@
# tearDownClass method of the super-class.
cls.existing_fixtures = []
cls.deleted_fixtures = []
- for x in range(2):
+ for _ in range(2):
srv = cls.create_test_server(wait_until='ACTIVE')
cls.existing_fixtures.append(srv)
diff --git a/tempest/api/compute/servers/test_server_group.py b/tempest/api/compute/servers/test_server_group.py
index bc49e7b..793d640 100644
--- a/tempest/api/compute/servers/test_server_group.py
+++ b/tempest/api/compute/servers/test_server_group.py
@@ -83,7 +83,7 @@
# Create and Delete the server-groups with same name and same policy
server_groups = []
server_group_name = data_utils.rand_name('server-group')
- for i in range(0, 2):
+ for _ in range(0, 2):
server_groups.append(self._create_server_group(server_group_name,
self.policy))
for key in ['name', 'policies']:
diff --git a/tempest/api/compute/volumes/test_volumes_list.py b/tempest/api/compute/volumes/test_volumes_list.py
index 82cc653..0481570 100644
--- a/tempest/api/compute/volumes/test_volumes_list.py
+++ b/tempest/api/compute/volumes/test_volumes_list.py
@@ -45,7 +45,7 @@
# Create 3 Volumes
cls.volume_list = []
cls.volume_id_list = []
- for i in range(3):
+ for _ in range(3):
metadata = {'Type': 'work'}
volume = cls.create_volume(metadata=metadata)
volume = cls.client.show_volume(volume['id'])['volume']
diff --git a/tempest/api/identity/admin/v2/test_endpoints.py b/tempest/api/identity/admin/v2/test_endpoints.py
index 651a316..0da579c 100644
--- a/tempest/api/identity/admin/v2/test_endpoints.py
+++ b/tempest/api/identity/admin/v2/test_endpoints.py
@@ -34,7 +34,7 @@
cls.service_ids.append(cls.service_id)
# Create endpoints so as to use for LIST and GET test cases
cls.setup_endpoints = list()
- for i in range(2):
+ for _ in range(2):
region = data_utils.rand_name('region')
url = data_utils.rand_url()
endpoint = cls.endpoints_client.create_endpoint(
diff --git a/tempest/api/identity/admin/v3/test_credentials.py b/tempest/api/identity/admin/v3/test_credentials.py
index a0d8748..d4fe32d 100644
--- a/tempest/api/identity/admin/v3/test_credentials.py
+++ b/tempest/api/identity/admin/v3/test_credentials.py
@@ -31,7 +31,7 @@
u_desc = '%s description' % u_name
u_email = '%s@testmail.tm' % u_name
u_password = data_utils.rand_password()
- for i in range(2):
+ for _ in range(2):
cls.project = cls.projects_client.create_project(
data_utils.rand_name('project'),
description=data_utils.rand_name('project-desc'))['project']
@@ -92,7 +92,7 @@
created_cred_ids = list()
fetched_cred_ids = list()
- for i in range(2):
+ for _ in range(2):
blob = '{"access": "%s", "secret": "%s"}' % (
data_utils.rand_name('Access'), data_utils.rand_name('Secret'))
cred = self.creds_client.create_credential(
diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py
index 655e4ef..ef450a2 100644
--- a/tempest/api/identity/admin/v3/test_endpoints.py
+++ b/tempest/api/identity/admin/v3/test_endpoints.py
@@ -40,7 +40,7 @@
cls.service_ids.append(cls.service_id)
# Create endpoints so as to use for LIST and GET test cases
cls.setup_endpoints = list()
- for i in range(2):
+ for _ in range(2):
region = data_utils.rand_name('region')
url = data_utils.rand_url()
interface = 'public'
diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py
index 3cbcc1f..34b4468 100644
--- a/tempest/api/identity/admin/v3/test_groups.py
+++ b/tempest/api/identity/admin/v3/test_groups.py
@@ -80,7 +80,7 @@
self.addCleanup(self.groups_client.delete_group, group['id'])
# add user into group
users = []
- for i in range(3):
+ for _ in range(3):
name = data_utils.rand_name('User')
password = data_utils.rand_password()
user = self.users_client.create_user(name=name,
@@ -110,7 +110,7 @@
self.addCleanup(self.users_client.delete_user, user['id'])
# create two groups, and add user into them
groups = []
- for i in range(2):
+ for _ in range(2):
name = data_utils.rand_name('Group')
group = self.groups_client.create_group(
name=name, domain_id=self.domain['id'])['group']
diff --git a/tempest/api/identity/admin/v3/test_regions.py b/tempest/api/identity/admin/v3/test_regions.py
index 95894a6..b5ea90d 100644
--- a/tempest/api/identity/admin/v3/test_regions.py
+++ b/tempest/api/identity/admin/v3/test_regions.py
@@ -30,7 +30,7 @@
def resource_setup(cls):
super(RegionsTestJSON, cls).resource_setup()
cls.setup_regions = list()
- for i in range(2):
+ for _ in range(2):
r_description = data_utils.rand_name('description')
region = cls.client.create_region(
description=r_description)['region']
diff --git a/tempest/api/identity/admin/v3/test_users.py b/tempest/api/identity/admin/v3/test_users.py
index 3ec4ff1..54c62c7 100644
--- a/tempest/api/identity/admin/v3/test_users.py
+++ b/tempest/api/identity/admin/v3/test_users.py
@@ -125,7 +125,7 @@
user = self.users_client.show_user(user_body['id'])['user']
role = self.roles_client.show_role(role_body['id'])['role']
- for i in range(2):
+ for _ in range(2):
# Creating project so as to assign role
project_body = self.projects_client.create_project(
data_utils.rand_name('project'),
diff --git a/tempest/api/identity/v2/test_users.py b/tempest/api/identity/v2/test_users.py
index bafb1f2..06730f8 100644
--- a/tempest/api/identity/v2/test_users.py
+++ b/tempest/api/identity/v2/test_users.py
@@ -58,7 +58,7 @@
if CONF.identity_feature_enabled.security_compliance:
# First we need to clear the password history
unique_count = CONF.identity.user_unique_last_password_count
- for i in range(unique_count):
+ for _ in range(unique_count):
random_pass = data_utils.rand_password()
self._update_password(
user_id, original_password=new_pass, password=random_pass)
diff --git a/tempest/api/identity/v3/test_users.py b/tempest/api/identity/v3/test_users.py
index f389a8f..9592cb9 100644
--- a/tempest/api/identity/v3/test_users.py
+++ b/tempest/api/identity/v3/test_users.py
@@ -60,7 +60,7 @@
if CONF.identity_feature_enabled.security_compliance:
# First we need to clear the password history
unique_count = CONF.identity.user_unique_last_password_count
- for i in range(unique_count):
+ for _ in range(unique_count):
random_pass = data_utils.rand_password()
self._update_password(
original_password=new_pass, password=random_pass)
@@ -142,7 +142,7 @@
# Lock user account by using the wrong password to login
bad_password = data_utils.rand_password()
- for i in range(CONF.identity.user_lockout_failure_attempts):
+ for _ in range(CONF.identity.user_lockout_failure_attempts):
self.assertRaises(exceptions.Unauthorized,
self.non_admin_token.auth,
user_id=self.user_id,
diff --git a/tempest/api/volume/admin/test_volumes_backup.py b/tempest/api/volume/admin/test_volumes_backup.py
index 7591612..61d4ba7 100644
--- a/tempest/api/volume/admin/test_volumes_backup.py
+++ b/tempest/api/volume/admin/test_volumes_backup.py
@@ -32,9 +32,6 @@
super(VolumesBackupsAdminV2Test, cls).skip_checks()
if not CONF.volume_feature_enabled.backup:
raise cls.skipException("Cinder backup feature disabled")
- if not CONF.service_available.swift:
- skip_msg = ("%s skipped as swift is not available" % cls.__name__)
- raise cls.skipException(skip_msg)
def _delete_backup(self, backup_id):
self.admin_backups_client.delete_backup(backup_id)
diff --git a/tempest/api/volume/test_volumes_backup.py b/tempest/api/volume/test_volumes_backup.py
index 03a3774..6dcde08 100644
--- a/tempest/api/volume/test_volumes_backup.py
+++ b/tempest/api/volume/test_volumes_backup.py
@@ -29,9 +29,6 @@
super(VolumesBackupsV2Test, cls).skip_checks()
if not CONF.volume_feature_enabled.backup:
raise cls.skipException("Cinder backup feature disabled")
- if not CONF.service_available.swift:
- skip_msg = ("%s skipped as swift is not available" % cls.__name__)
- raise cls.skipException(skip_msg)
def restore_backup(self, backup_id):
# Restore a backup