Clean up pep8 E128 violations
Fixed E128 errors.
All ignores are to be removed in the next sequence of patches.
Change-Id: If014be8524a43842b7e6aa3243c517aa25980976
diff --git a/stress/driver.py b/stress/driver.py
index bdb5d4b..9ab6fb8 100644
--- a/stress/driver.py
+++ b/stress/driver.py
@@ -73,9 +73,8 @@
nodes = []
if keypath is None or user is None:
return nodes
- lines = utils.util.ssh(keypath, user, controller,
- "nova-manage service list | grep ^nova-compute").\
- split('\n')
+ cmd = "nova-manage service list | grep ^nova-compute"
+ lines = utils.util.ssh(keypath, user, controller, cmd).split('\n')
# For example: nova-compute xg11eth0 nova enabled :-) 2011-10-31 18:57:46
# This is fragile but there is, at present, no other way to get this info.
for line in lines:
diff --git a/stress/test_floating_ips.py b/stress/test_floating_ips.py
index 536179c..302385a 100755
--- a/stress/test_floating_ips.py
+++ b/stress/test_floating_ips.py
@@ -82,13 +82,13 @@
conn.close()
if self.add:
self._logger.info('%s added [%.1f secs elapsed]' %
- (self.floating_ip.address, self.elapsed()))
+ (self.floating_ip.address, self.elapsed()))
self.floating_ip.change_pending = False
return True
except:
if not self.add:
self._logger.info('%s removed [%.1f secs elapsed]' %
- (self.floating_ip.address, self.elapsed()))
+ (self.floating_ip.address, self.elapsed()))
self.floating_ip.change_pending = False
self.floating_ip.server_id = None
return True
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index 7e3084b..b2d3e22 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -192,7 +192,7 @@
req_url = "%s/%s" % (self.base_url, url)
resp, resp_body = self.http_obj.request(req_url, method,
- headers=headers, body=body)
+ headers=headers, body=body)
if resp.status == 401 or resp.status == 403:
self._log(req_url, body, resp, resp_body)
raise exceptions.Unauthorized()
diff --git a/tempest/config.py b/tempest/config.py
index 38455b2..52a4aad 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -407,9 +407,8 @@
# Environment variables override defaults...
conf_dir = os.environ.get('TEMPEST_CONFIG_DIR',
- self.DEFAULT_CONFIG_DIR)
- conf_file = os.environ.get('TEMPEST_CONFIG',
- self.DEFAULT_CONFIG_FILE)
+ self.DEFAULT_CONFIG_DIR)
+ conf_file = os.environ.get('TEMPEST_CONFIG', self.DEFAULT_CONFIG_FILE)
path = os.path.join(conf_dir, conf_file)
diff --git a/tempest/manager.py b/tempest/manager.py
index 21fa648..6bb713b 100644
--- a/tempest/manager.py
+++ b/tempest/manager.py
@@ -127,10 +127,11 @@
client_args = (username, password, tenant_name, auth_url)
# Create our default Nova client to use in testing
+ service_type = self.config.compute.catalog_type,
return novaclient.client.Client(self.NOVACLIENT_VERSION,
- *client_args,
- service_type=self.config.compute.catalog_type,
- no_cache=True)
+ *client_args,
+ service_type=service_type,
+ no_cache=True)
def _get_image_client(self):
keystone = self._get_identity_client()
diff --git a/tempest/openstack.py b/tempest/openstack.py
index d9abb64..d9cb0a1 100644
--- a/tempest/openstack.py
+++ b/tempest/openstack.py
@@ -226,9 +226,9 @@
def __init__(self, interface='json'):
conf = config.TempestConfig()
super(IdentityManager, self).__init__(conf.identity_admin.username,
- conf.identity_admin.password,
- conf.identity_admin.tenant_name,
- interface)
+ conf.identity_admin.password,
+ conf.identity_admin.tenant_name,
+ interface)
class IdentityNaManager(Manager):
@@ -241,6 +241,6 @@
def __init__(self, interface='json'):
conf = config.TempestConfig()
super(IdentityNaManager, self).__init__(conf.compute.username,
- conf.compute.password,
- conf.compute.tenant_name,
- interface)
+ conf.compute.password,
+ conf.compute.tenant_name,
+ interface)
diff --git a/tempest/services/identity/json/admin_client.py b/tempest/services/identity/json/admin_client.py
index aa3a52a..c976613 100644
--- a/tempest/services/identity/json/admin_client.py
+++ b/tempest/services/identity/json/admin_client.py
@@ -75,8 +75,8 @@
def remove_user_role(self, tenant_id, user_id, role_id):
"""Removes a role assignment for a user on a tenant"""
- return self.delete('/tenants/%s/users/%s/roles/OS-KSADM/%s'
- % (tenant_id, user_id, role_id))
+ return self.delete('/tenants/%s/users/%s/roles/OS-KSADM/%s' %
+ (tenant_id, user_id, role_id))
def delete_tenant(self, tenant_id):
"""Delete a tenant"""
@@ -157,7 +157,7 @@
}
put_body = json.dumps({'user': put_body})
resp, body = self.put('users/%s/enabled' % user_id,
- put_body, self.headers)
+ put_body, self.headers)
body = json.loads(body)
return resp, body
diff --git a/tempest/services/identity/xml/admin_client.py b/tempest/services/identity/xml/admin_client.py
index dd18cd6..8d056e5 100644
--- a/tempest/services/identity/xml/admin_client.py
+++ b/tempest/services/identity/xml/admin_client.py
@@ -110,8 +110,8 @@
def remove_user_role(self, tenant_id, user_id, role_id):
"""Removes a role assignment for a user on a tenant"""
- return self.delete('/tenants/%s/users/%s/roles/OS-KSADM/%s'
- % (tenant_id, user_id, role_id), self.headers)
+ return self.delete('/tenants/%s/users/%s/roles/OS-KSADM/%s' %
+ (tenant_id, user_id, role_id), self.headers)
def delete_tenant(self, tenant_id):
"""Delete a tenant"""
@@ -184,7 +184,7 @@
enable_user = Element("user",
enabled=str(enabled).lower())
resp, body = self.put('users/%s/enabled' % user_id,
- str(Document(enable_user)), self.headers)
+ str(Document(enable_user)), self.headers)
body = self._parse_array(etree.fromstring(body))
return resp, body
@@ -203,10 +203,10 @@
"""Create a service"""
OS_KSADM = "http://docs.openstack.org/identity/api/ext/OS-KSADM/v1.0"
create_service = Element("service",
- xmlns=OS_KSADM,
- name=name,
- type=type,
- description=kwargs.get('description'))
+ xmlns=OS_KSADM,
+ name=name,
+ type=type,
+ description=kwargs.get('description'))
resp, body = self.post('OS-KSADM/services',
str(Document(create_service)),
self.headers)
@@ -233,8 +233,8 @@
def auth(self, user, password, tenant):
passwordCreds = Element("passwordCredentials",
- username=user,
- password=password)
+ username=user,
+ password=password)
auth = Element("auth",
tenantName=tenant)
auth.append(passwordCreds)
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 49b83fe..8253f6a 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -6,7 +6,7 @@
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(NetworkClient, self).__init__(config, username, password,
- auth_url, tenant_name)
+ auth_url, tenant_name)
self.service = self.config.network.catalog_type
def list_networks(self):
diff --git a/tempest/services/nova/json/console_output_client.py b/tempest/services/nova/json/console_output_client.py
index 4a8795b..b2f2a39 100644
--- a/tempest/services/nova/json/console_output_client.py
+++ b/tempest/services/nova/json/console_output_client.py
@@ -6,7 +6,7 @@
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(ConsoleOutputsClient, self).__init__(config, username, password,
- auth_url, tenant_name)
+ auth_url, tenant_name)
self.service = self.config.compute.catalog_type
def get_console_output(self, server_id, length):
diff --git a/tempest/services/nova/json/extensions_client.py b/tempest/services/nova/json/extensions_client.py
index 8eeb382..620b240 100644
--- a/tempest/services/nova/json/extensions_client.py
+++ b/tempest/services/nova/json/extensions_client.py
@@ -6,7 +6,7 @@
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(ExtensionsClientJSON, self).__init__(config, username, password,
- auth_url, tenant_name)
+ auth_url, tenant_name)
self.service = self.config.compute.catalog_type
def list_extensions(self):
diff --git a/tempest/services/nova/json/flavors_client.py b/tempest/services/nova/json/flavors_client.py
index 9397148..a95eb6a 100644
--- a/tempest/services/nova/json/flavors_client.py
+++ b/tempest/services/nova/json/flavors_client.py
@@ -41,7 +41,7 @@
return resp, body['flavor']
def create_flavor(self, name, ram, vcpus, disk, ephemeral, flavor_id,
- swap, rxtx):
+ swap, rxtx):
"""Creates a new flavor or instance type"""
post_body = {
'name': name,
diff --git a/tempest/services/nova/json/floating_ips_client.py b/tempest/services/nova/json/floating_ips_client.py
index efcd49f..8a1b08f 100644
--- a/tempest/services/nova/json/floating_ips_client.py
+++ b/tempest/services/nova/json/floating_ips_client.py
@@ -6,7 +6,7 @@
class FloatingIPsClientJSON(RestClient):
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(FloatingIPsClientJSON, self).__init__(config, username, password,
- auth_url, tenant_name)
+ auth_url, tenant_name)
self.service = self.config.compute.catalog_type
def list_floating_ips(self, params=None):
diff --git a/tempest/services/nova/json/limits_client.py b/tempest/services/nova/json/limits_client.py
index d0dc153..1f83ebf 100644
--- a/tempest/services/nova/json/limits_client.py
+++ b/tempest/services/nova/json/limits_client.py
@@ -6,7 +6,7 @@
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(LimitsClientJSON, self).__init__(config, username, password,
- auth_url, tenant_name)
+ auth_url, tenant_name)
self.service = self.config.compute.catalog_type
def get_limits(self):
diff --git a/tempest/services/nova/json/security_groups_client.py b/tempest/services/nova/json/security_groups_client.py
index 4d5d874..1f93fd4 100644
--- a/tempest/services/nova/json/security_groups_client.py
+++ b/tempest/services/nova/json/security_groups_client.py
@@ -6,7 +6,7 @@
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(SecurityGroupsClient, self).__init__(config, username, password,
- auth_url, tenant_name)
+ auth_url, tenant_name)
self.service = self.config.compute.catalog_type
def list_security_groups(self, params=None):
diff --git a/tempest/services/nova/json/servers_client.py b/tempest/services/nova/json/servers_client.py
index eedc362..8773738 100644
--- a/tempest/services/nova/json/servers_client.py
+++ b/tempest/services/nova/json/servers_client.py
@@ -147,9 +147,9 @@
timed_out = int(time.time()) - start >= self.build_timeout
if server_status != status and timed_out:
- message = 'Server %s failed to reach %s status within the '\
- 'required time (%s s).' % (server_id, status,
- self.build_timeout)
+ message = ('Server %s failed to reach %s status within the '
+ 'required time (%s s).' %
+ (server_id, status, self.build_timeout))
message += ' Current status: %s.' % server_status
raise exceptions.TimeoutException(message)
diff --git a/tempest/services/nova/json/volumes_extensions_client.py b/tempest/services/nova/json/volumes_extensions_client.py
index 319915c..1a234bd 100644
--- a/tempest/services/nova/json/volumes_extensions_client.py
+++ b/tempest/services/nova/json/volumes_extensions_client.py
@@ -8,8 +8,8 @@
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(VolumesExtensionsClientJSON, self).__init__(config, username,
- password, auth_url,
- tenant_name)
+ password, auth_url,
+ tenant_name)
self.service = self.config.compute.catalog_type
self.build_interval = self.config.volume.build_interval
self.build_timeout = self.config.volume.build_timeout
@@ -87,9 +87,9 @@
raise exceptions.VolumeBuildErrorException(volume_id=volume_id)
if int(time.time()) - start >= self.build_timeout:
- message = 'Volume %s failed to reach %s status within '\
- 'the required time (%s s).' % (volume_name, status,
- self.build_timeout)
+ message = ('Volume %s failed to reach %s status within '
+ 'the required time (%s s).' %
+ (volume_name, status, self.build_timeout))
raise exceptions.TimeoutException(message)
def is_resource_deleted(self, id):
diff --git a/tempest/services/nova/xml/extensions_client.py b/tempest/services/nova/xml/extensions_client.py
index 7ae4214..c64efc8 100644
--- a/tempest/services/nova/xml/extensions_client.py
+++ b/tempest/services/nova/xml/extensions_client.py
@@ -7,7 +7,7 @@
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(ExtensionsClientXML, self).__init__(config, username, password,
- auth_url, tenant_name)
+ auth_url, tenant_name)
self.service = self.config.compute.catalog_type
def _parse_array(self, node):
diff --git a/tempest/services/nova/xml/flavors_client.py b/tempest/services/nova/xml/flavors_client.py
index 3ed65bc..43a9a11 100644
--- a/tempest/services/nova/xml/flavors_client.py
+++ b/tempest/services/nova/xml/flavors_client.py
@@ -68,7 +68,7 @@
return resp, flavor
def create_flavor(self, name, ram, vcpus, disk, ephemeral, flavor_id,
- swap, rxtx):
+ swap, rxtx):
"""Creates a new flavor or instance type"""
flavor = Element("flavor",
xmlns=XMLNS_11,
diff --git a/tempest/services/nova/xml/floating_ips_client.py b/tempest/services/nova/xml/floating_ips_client.py
index a5993d4..21b0cc5 100644
--- a/tempest/services/nova/xml/floating_ips_client.py
+++ b/tempest/services/nova/xml/floating_ips_client.py
@@ -27,7 +27,7 @@
class FloatingIPsClientXML(RestClientXML):
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(FloatingIPsClientXML, self).__init__(config, username, password,
- auth_url, tenant_name)
+ auth_url, tenant_name)
self.service = self.config.compute.catalog_type
def _parse_array(self, node):
diff --git a/tempest/services/nova/xml/limits_client.py b/tempest/services/nova/xml/limits_client.py
index 3f47484..75142a9 100644
--- a/tempest/services/nova/xml/limits_client.py
+++ b/tempest/services/nova/xml/limits_client.py
@@ -26,7 +26,7 @@
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(LimitsClientXML, self).__init__(config, username, password,
- auth_url, tenant_name)
+ auth_url, tenant_name)
self.service = self.config.compute.catalog_type
def get_limits(self):
diff --git a/tempest/services/nova/xml/servers_client.py b/tempest/services/nova/xml/servers_client.py
index 833e6d7..27eb10b 100644
--- a/tempest/services/nova/xml/servers_client.py
+++ b/tempest/services/nova/xml/servers_client.py
@@ -197,9 +197,9 @@
timed_out = int(time.time()) - start >= self.build_timeout
if server_status != status and timed_out:
- message = 'Server %s failed to reach %s status within the '\
- 'required time (%s s).' % (server_id, status,
- self.build_timeout)
+ message = ('Server %s failed to reach %s status within the '
+ 'required time (%s s).' %
+ (server_id, status, self.build_timeout))
message += ' Current status: %s.' % server_status
raise exceptions.TimeoutException(message)
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index b061c9f..2c9f8c3 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -29,7 +29,7 @@
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(VolumesClientJSON, self).__init__(config, username, password,
- auth_url, tenant_name)
+ auth_url, tenant_name)
self.service = self.config.volume.catalog_type
self.build_interval = self.config.volume.build_interval
@@ -126,9 +126,9 @@
raise exceptions.VolumeBuildErrorException(volume_id=volume_id)
if int(time.time()) - start >= self.build_timeout:
- message = 'Volume %s failed to reach %s status within '\
- 'the required time (%s s).' % (volume_name, status,
- self.build_timeout)
+ message = ('Volume %s failed to reach %s status within '
+ 'the required time (%s s).' %
+ (volume_name, status, self.build_timeout))
raise exceptions.TimeoutException(message)
def is_resource_deleted(self, id):
diff --git a/tempest/tests/compute/test_attach_volume.py b/tempest/tests/compute/test_attach_volume.py
index 7fe86dd..cb695c1 100644
--- a/tempest/tests/compute/test_attach_volume.py
+++ b/tempest/tests/compute/test_attach_volume.py
@@ -46,9 +46,9 @@
# Start a server and wait for it to become ready
resp, server = self.servers_client.create_server(name,
- self.image_ref,
- self.flavor_ref,
- adminPass='password')
+ self.image_ref,
+ self.flavor_ref,
+ adminPass='password')
self.servers_client.wait_for_server_status(server['id'], 'ACTIVE')
# Record addresses so that we can ssh later
@@ -62,7 +62,7 @@
# Attach the volume to the server
self.servers_client.attach_volume(server['id'], volume['id'],
- device='/dev/%s' % self.device)
+ device='/dev/%s' % self.device)
self.volumes_client.wait_for_volume_status(volume['id'], 'in-use')
return server, volume
diff --git a/tempest/tests/compute/test_authorization.py b/tempest/tests/compute/test_authorization.py
index 86867e2..b9d1051 100644
--- a/tempest/tests/compute/test_authorization.py
+++ b/tempest/tests/compute/test_authorization.py
@@ -220,8 +220,8 @@
self.alt_keypairs_client.base_url = self.saved_base_url
if (resp['status'] is not None):
resp, _ = self.alt_keypairs_client.delete_keypair(k_name)
- self.fail("Create keypair request should not happen if the"
- " tenant id does not match the current user")
+ self.fail("Create keypair request should not happen "
+ "if the tenant id does not match the current user")
@raises(exceptions.NotFound)
@attr(type='negative')
@@ -369,7 +369,7 @@
""" A get metadata for another user's image should fail """
req_metadata = {'meta1': 'value1'}
self.images_client.set_image_metadata(self.image['id'],
- req_metadata)
+ req_metadata)
try:
resp, meta = \
self.alt_images_client.get_image_metadata_item(self.image['id'],
diff --git a/tempest/tests/compute/test_console_output.py b/tempest/tests/compute/test_console_output.py
index 8af7467..4503017 100644
--- a/tempest/tests/compute/test_console_output.py
+++ b/tempest/tests/compute/test_console_output.py
@@ -32,8 +32,8 @@
cls.servers_client = cls.servers_client
cls.name = rand_name('server')
resp, server = cls.servers_client.create_server(cls.name,
- cls.image_ref,
- cls.flavor_ref)
+ cls.image_ref,
+ cls.flavor_ref)
cls.server_id = server['id']
cls.servers_client.wait_for_server_status(cls.server_id, 'ACTIVE')
diff --git a/tempest/tests/compute/test_create_server.py b/tempest/tests/compute/test_create_server.py
index d912456..5d6c2ba 100644
--- a/tempest/tests/compute/test_create_server.py
+++ b/tempest/tests/compute/test_create_server.py
@@ -40,13 +40,14 @@
personality = [{'path': '/etc/test.txt',
'contents': base64.b64encode(file_contents)}]
cls.client = cls.servers_client
- cls.resp, cls.server_initial = cls.client.create_server(cls.name,
- cls.image_ref,
- cls.flavor_ref,
- meta=cls.meta,
- accessIPv4=cls.accessIPv4,
- accessIPv6=cls.accessIPv6,
- personality=personality)
+ cli_resp = cls.client.create_server(cls.name,
+ cls.image_ref,
+ cls.flavor_ref,
+ meta=cls.meta,
+ accessIPv4=cls.accessIPv4,
+ accessIPv6=cls.accessIPv6,
+ personality=personality)
+ cls.resp, cls.server_initial = cli_resp
cls.password = cls.server_initial['adminPass']
cls.client.wait_for_server_status(cls.server_initial['id'], 'ACTIVE')
resp, cls.server = cls.client.get_server(cls.server_initial['id'])
diff --git a/tempest/tests/compute/test_flavors.py b/tempest/tests/compute/test_flavors.py
index ac5aac5..e937a51 100644
--- a/tempest/tests/compute/test_flavors.py
+++ b/tempest/tests/compute/test_flavors.py
@@ -74,7 +74,7 @@
params = {'marker': flavor_id}
resp, flavors = self.client.list_flavors(params)
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]),
- 'The list of flavors did not start after the marker.')
+ 'The list of flavors did not start after the marker.')
@attr(type='positive')
def test_list_flavors_detailed_using_marker(self):
@@ -85,7 +85,7 @@
params = {'marker': flavor_id}
resp, flavors = self.client.list_flavors_with_detail(params)
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]),
- 'The list of flavors did not start after the marker.')
+ 'The list of flavors did not start after the marker.')
@attr(type='positive')
def test_list_flavors_detailed_filter_by_min_disk(self):
@@ -135,7 +135,7 @@
def test_get_flavor_details_for_invalid_flavor_id(self):
"""Ensure 404 returned for non-existant flavor ID"""
self.assertRaises(exceptions.NotFound, self.client.get_flavor_details,
- 9999)
+ 9999)
class FlavorsTestXML(base.BaseComputeTestXML,
diff --git a/tempest/tests/compute/test_floating_ips_actions.py b/tempest/tests/compute/test_floating_ips_actions.py
index 5612a12..2b01bca 100644
--- a/tempest/tests/compute/test_floating_ips_actions.py
+++ b/tempest/tests/compute/test_floating_ips_actions.py
@@ -193,15 +193,15 @@
except exceptions.NotFound:
pass
else:
- self.fail('The floating IP should be associated to the second'
- 'server')
+ self.fail('The floating IP should be associated to the second '
+ 'server')
if (resp['status'] is not None):
#Dissociation of the floating IP associated in this method
resp, _ = \
self.client.disassociate_floating_ip_from_server(
self.floating_ip,
self.new_server_id)
- #Deletion of server created in this method
+ #Deletion of server created in this method
resp, body = self.servers_client.delete_server(self.new_server_id)
@unittest.skip("Skipped until the Bug #957706 is resolved")
diff --git a/tempest/tests/compute/test_image_metadata.py b/tempest/tests/compute/test_image_metadata.py
index 76cbe9d..1de277a 100644
--- a/tempest/tests/compute/test_image_metadata.py
+++ b/tempest/tests/compute/test_image_metadata.py
@@ -159,7 +159,7 @@
meta = {'key1': 'alt'}
try:
resp, body = self.client.set_image_metadata_item(999,
- 'key1', meta)
+ 'key1', meta)
resp, metadata = self.client.list_image_metadata(999)
except exceptions.NotFound:
pass
diff --git a/tempest/tests/compute/test_images.py b/tempest/tests/compute/test_images.py
index 82dba33..9101f14 100644
--- a/tempest/tests/compute/test_images.py
+++ b/tempest/tests/compute/test_images.py
@@ -138,8 +138,8 @@
"""Return error when creating an image of a server that is building"""
server_name = rand_name('test-vm-')
resp, server = self.servers_client.create_server(server_name,
- self.image_ref,
- self.flavor_ref)
+ self.image_ref,
+ self.flavor_ref)
self.servers.append(server)
snapshot_name = rand_name('test-snap-')
self.assertRaises(exceptions.Duplicate, self.client.create_image,
@@ -164,7 +164,7 @@
snapshot_name = rand_name('test-snap-')
self.assertRaises(exceptions.Duplicate, self.client.create_image,
- server['id'], snapshot_name)
+ server['id'], snapshot_name)
@attr(type='negative')
def test_create_second_image_when_first_image_is_being_saved(self):
@@ -197,7 +197,7 @@
try:
snapshot_name = rand_name('a' * 260)
self.assertRaises(exceptions.BadRequest, self.client.create_image,
- server['id'], snapshot_name)
+ server['id'], snapshot_name)
except:
self.fail("Should return 400 Bad Request if image name is over 256"
" characters")
@@ -235,8 +235,8 @@
try:
snapshot_name = rand_name('\xef\xbb\xbf')
self.assertRaises(exceptions.BadRequest,
- self.client.create_image, server['id'],
- snapshot_name)
+ self.client.create_image, server['id'],
+ snapshot_name)
except:
self.fail("Should return 400 Bad Request if multi byte characters"
" are used for image name")
@@ -310,7 +310,7 @@
image_id = '11a22b9-120q-5555-cc11-00ab112223gj'
try:
self.assertRaises(exceptions.NotFound, self.client.delete_image,
- image_id)
+ image_id)
except:
self.fail("Did not return HTTP 404 NotFound for non hex image")
@@ -322,8 +322,7 @@
self.assertRaises(exceptions.NotFound, self.client.delete_image,
-1)
except:
- self.fail("Did not return HTTP 404 NotFound for negative image "
- "id")
+ self.fail("Did not return HTTP 404 NotFound for negative image id")
@attr(type='negative')
def test_delete_image_id_is_over_35_character_limit(self):
@@ -352,7 +351,7 @@
# Delete image
self.assertRaises(exceptions.NotFound,
- self.alt_client.delete_image, image_id)
+ self.alt_client.delete_image, image_id)
@attr(type='negative')
def test_delete_image_that_is_not_yet_active(self):
diff --git a/tempest/tests/compute/test_keypairs.py b/tempest/tests/compute/test_keypairs.py
index 33a26c9..2426182 100644
--- a/tempest/tests/compute/test_keypairs.py
+++ b/tempest/tests/compute/test_keypairs.py
@@ -69,9 +69,10 @@
private_key = keypair['private_key']
key_name = keypair['name']
self.assertEqual(key_name, k_name,
- "The created keypair name is not equal to the requested name")
+ "The created keypair name is not equal "
+ "to the requested name")
self.assertTrue(private_key is not None,
- "Field private_key is empty or not found.")
+ "Field private_key is empty or not found.")
resp, _ = self.client.delete_keypair(k_name)
self.assertEqual(202, resp.status)
@@ -87,10 +88,11 @@
self.assertTrue('name' in keypair_detail)
self.assertTrue('public_key' in keypair_detail)
self.assertEqual(keypair_detail['name'], k_name,
- "The created keypair name is not equal to requested name")
+ "The created keypair name is not equal "
+ "to requested name")
public_key = keypair_detail['public_key']
self.assertTrue(public_key is not None,
- "Field public_key is empty or not found.")
+ "Field public_key is empty or not found.")
except:
self.fail("GET keypair details requested by keypair name"
" has failed")
@@ -114,10 +116,11 @@
resp, keypair = self.client.create_keypair(k_name, pub_key)
self.assertEqual(200, resp.status)
self.assertFalse('private_key' in keypair,
- "Field private_key is not empty!")
+ "Field private_key is not empty!")
key_name = keypair['name']
self.assertEqual(key_name, k_name,
- "The created keypair name is not equal to the requested name!")
+ "The created keypair name is not equal "
+ "to the requested name!")
resp, _ = self.client.delete_keypair(k_name)
self.assertEqual(202, resp.status)
diff --git a/tempest/tests/compute/test_list_floating_ips.py b/tempest/tests/compute/test_list_floating_ips.py
index ac70b8f..34d7369 100644
--- a/tempest/tests/compute/test_list_floating_ips.py
+++ b/tempest/tests/compute/test_list_floating_ips.py
@@ -67,10 +67,10 @@
self.assertEqual(200, resp.status)
#Comparing the details of floating IP
self.assertEqual(floating_ip_instance_id,
- body['instance_id'])
+ body['instance_id'])
self.assertEqual(floating_ip_ip, body['ip'])
self.assertEqual(floating_ip_fixed_ip,
- body['fixed_ip'])
+ body['fixed_ip'])
self.assertEqual(floating_ip_id, body['id'])
#Deleting the floating IP created in this method
finally:
@@ -102,7 +102,7 @@
class FloatingIPDetailsTestJSON(base.BaseComputeTestJSON,
- FloatingIPDetailsTestBase):
+ FloatingIPDetailsTestBase):
@classmethod
def setUpClass(cls):
super(FloatingIPDetailsTestJSON, cls).setUpClass()
@@ -115,7 +115,7 @@
class FloatingIPDetailsTestXML(base.BaseComputeTestXML,
- FloatingIPDetailsTestBase):
+ FloatingIPDetailsTestBase):
@classmethod
def setUpClass(cls):
super(FloatingIPDetailsTestXML, cls).setUpClass()
diff --git a/tempest/tests/compute/test_list_image_filters.py b/tempest/tests/compute/test_list_image_filters.py
index 4f9fa22..b6be358 100644
--- a/tempest/tests/compute/test_list_image_filters.py
+++ b/tempest/tests/compute/test_list_image_filters.py
@@ -127,11 +127,11 @@
resp, images = self.client.list_images(params)
self.assertFalse(any([i for i in images
- if i['id'] == self.image1_id]))
+ if i['id'] == self.image1_id]))
self.assertFalse(any([i for i in images
- if i['id'] == self.image2_id]))
+ if i['id'] == self.image2_id]))
self.assertTrue(any([i for i in images
- if i['id'] == self.image3_id]))
+ if i['id'] == self.image3_id]))
@attr(type='positive')
def test_list_images_filter_by_type(self):
@@ -209,11 +209,11 @@
resp, images = self.client.list_images_with_detail(params)
self.assertFalse(any([i for i in images
- if i['id'] == self.image1_id]))
+ if i['id'] == self.image1_id]))
self.assertFalse(any([i for i in images
- if i['id'] == self.image2_id]))
+ if i['id'] == self.image2_id]))
self.assertTrue(any([i for i in images
- if i['id'] == self.image3_id]))
+ if i['id'] == self.image3_id]))
@attr(type='positive')
def test_list_images_with_detail_filter_by_type(self):
diff --git a/tempest/tests/compute/test_list_servers_negative.py b/tempest/tests/compute/test_list_servers_negative.py
index d026977..2279959 100644
--- a/tempest/tests/compute/test_list_servers_negative.py
+++ b/tempest/tests/compute/test_list_servers_negative.py
@@ -61,8 +61,9 @@
"""Returns active test instances to calling test methods"""
resp, body = self.client.list_servers_with_detail()
servers = body['servers']
- active_servers = [server for server in servers if server['status'] ==
- 'ACTIVE']
+ active_servers = [
+ server for server in servers if server['status'] == 'ACTIVE'
+ ]
num_of_active_servers = len(active_servers)
# Check if we already have enough active servers
@@ -117,7 +118,7 @@
# Create a snapshot of the server
snapshot_name = "%s_snapshot" % base_server['id']
resp, body = self.client.create_image(base_server['id'],
- snapshot_name)
+ snapshot_name)
snapshot_url = resp['location']
match = re.search('/images/(?P<image_id>.+)', snapshot_url)
self.assertIsNotNone(match)
@@ -141,8 +142,8 @@
resp, body = self.client.list_servers({'image': snapshot_id})
servers = body['servers']
self.assertEqual('200', resp['status'])
- self.assertIn(snap_server['id'], [server['id'] for server in
- servers])
+ self.assertIn(snap_server['id'],
+ [server['id'] for server in servers])
self.assertEqual(1, len(body['servers']))
finally:
@@ -152,19 +153,19 @@
def test_list_servers_by_non_existing_image(self):
"""Listing servers for a non existing image raises error"""
self.assertRaises(exceptions.NotFound, self.client.list_servers,
- {'image': '1234abcd-zzz0-aaa9-ppp3-0987654abcde'})
+ {'image': '1234abcd-zzz0-aaa9-ppp3-0987654abcde'})
@unittest.skip("Until Bug 1002911 is fixed")
def test_list_servers_by_image_pass_overlimit_image(self):
"""Return an error while listing server with too large image id"""
self.assertRaises(exceptions.OverLimit, self.client.list_servers,
- {'image': sys.maxint + 1})
+ {'image': sys.maxint + 1})
@unittest.skip("Until Bug 1002911 is fixed")
def test_list_servers_by_image_pass_negative_id(self):
"""Return an error while listing server with negative image id"""
self.assertRaises(exceptions.BadRequest, self.client.list_servers,
- {'image': -1})
+ {'image': -1})
def test_list_servers_by_existing_flavor(self):
"""List servers by flavor"""
@@ -178,25 +179,25 @@
def test_list_servers_by_non_existing_flavor(self):
"""Return an error while listing server by non existing flavor"""
self.assertRaises(exceptions.NotFound, self.client.list_servers,
- {'flavor': 1234})
+ {'flavor': 1234})
@unittest.skip("Until Bug 1002918 is fixed")
def test_list_servers_by_flavor_pass_overlimit_flavor(self):
"""Return an error while listing server with too large flavor value"""
self.assertRaises(exceptions.OverLimit, self.client.list_servers,
- {'flavor': sys.maxint + 1})
+ {'flavor': sys.maxint + 1})
@unittest.skip("Until Bug 1002918 is fixed")
def test_list_servers_by_flavor_pass_negative_value(self):
"""Return an error while listing server with negative flavor value"""
self.assertRaises(exceptions.BadRequest, self.client.list_servers,
- {'flavor': -1})
+ {'flavor': -1})
def test_list_servers_by_server_name(self):
"""Returns a list of servers containing an existing server name"""
server_name = rand_name('test-vm-')
resp, server = self.client.create_server(server_name, self.image_ref,
- self.flavor_ref)
+ self.flavor_ref)
self.servers.append(server['id'])
resp, body = self.client.list_servers({'name': server_name})
@@ -214,19 +215,19 @@
def test_list_servers_by_server_name_empty(self):
"""Return an error when an empty server name is passed"""
self.assertRaises(exceptions.BadRequest, self.client.list_servers,
- {'name': ''})
+ {'name': ''})
@unittest.skip("Until Bug 1002892 is fixed")
def test_list_servers_by_server_name_too_large(self):
"""Return an error for a very large value for server name listing"""
self.assertRaises(exceptions.OverLimit, self.client.list_servers,
- {'name': 'a' * 65})
+ {'name': 'a' * 65})
@unittest.skip("Until Bug 1002892 is fixed")
def test_list_servers_by_name_pass_numeric_name(self):
"""Return an error for a numeric server name listing"""
self.assertRaises(exceptions.BadRequest, self.client.list_servers,
- {'name': 99})
+ {'name': 99})
def test_list_servers_by_active_status(self):
"""Return a listing of servers by active status"""
@@ -239,7 +240,7 @@
"""Return a listing of servers in build state"""
server_name = rand_name('test-vm-')
resp, server = self.client.create_server(server_name, self.image_ref,
- self.flavor_ref)
+ self.flavor_ref)
self.servers.append(server['id'])
resp, body = self.client.list_servers({'status': 'BUILD'})
self.assertEqual('200', resp['status'])
@@ -256,7 +257,7 @@
def test_list_servers_pass_numeric_status(self):
"""Return an error when a numeric value for status is specified"""
self.assertRaises(exceptions.BadRequest, self.client.list_servers,
- {'status': 1})
+ {'status': 1})
def test_list_servers_by_limits(self):
"""List servers by specifying limits"""
@@ -275,18 +276,18 @@
def test_list_servers_by_limits_pass_string(self):
"""Return an error if a string value is passed for limit"""
self.assertRaises(exceptions.BadRequest, self.client.list_servers,
- {'limit': 'testing'})
+ {'limit': 'testing'})
def test_list_servers_by_limits_pass_negative_value(self):
"""Return an error if a negative value for limit is passed"""
self.assertRaises(exceptions.BadRequest, self.client.list_servers,
- {'limit': -1})
+ {'limit': -1})
@unittest.skip("Until Bug 1002924 is fixed")
def test_list_servers_by_limits_pass_overlimit_value(self):
"""Return an error if too large value for limit is passed"""
self.assertRaises(exceptions.OverLimit, self.client.list_servers,
- {'limit': sys.maxint + 1})
+ {'limit': sys.maxint + 1})
def test_list_servers_by_changes_since(self):
"""Servers are listed by specifying changes-since date"""
@@ -318,7 +319,7 @@
# List the servers by alternate user in the base user's tenant
self.assertRaises(exceptions.NotFound, self.alt_client.list_servers,
- {'name': server_name})
+ {'name': server_name})
def test_list_servers_detail_when_no_servers_running(self):
"""Return an empty list for servers detail when no active servers"""
@@ -363,7 +364,7 @@
def test_get_server_details_non_existent_id(self):
"""Return an error during get server details using non-existent id"""
self.assertRaises(exceptions.NotFound, self.client.get_server,
- 'junk-123ab-45cd')
+ 'junk-123ab-45cd')
def test_get_server_details_another_tenant_server(self):
"""Return an error when querying details of server in another tenant"""
@@ -378,7 +379,7 @@
"""Return an error when a string value is passed for uuid"""
try:
self.assertRaises(exceptions.NotFound, self.client.get_server,
- 'junk-server-uuid')
+ 'junk-server-uuid')
except Exception as e:
self.fail("Incorrect Exception raised: %s" % e)
@@ -387,7 +388,7 @@
"""Return an error when a negative value is passed for uuid"""
try:
self.assertRaises(exceptions.BadRequest, self.client.get_server,
- -1)
+ -1)
except Exception as e:
self.fail("Incorrect Exception raised: %s" % e)
diff --git a/tempest/tests/compute/test_security_groups.py b/tempest/tests/compute/test_security_groups.py
index 4444d62..14e8ad0 100644
--- a/tempest/tests/compute/test_security_groups.py
+++ b/tempest/tests/compute/test_security_groups.py
@@ -275,8 +275,8 @@
# above to the server we just created
server_name = rand_name('server')
resp, server = self.servers_client.create_server(server_name,
- self.image_ref,
- self.flavor_ref)
+ self.image_ref,
+ self.flavor_ref)
server_id = server['id']
self.servers_client.wait_for_server_status(server_id, 'ACTIVE')
resp, body = self.servers_client.add_security_group(server_id,
diff --git a/tempest/tests/compute/test_server_actions.py b/tempest/tests/compute/test_server_actions.py
index e0bb47b..dd6b02f 100644
--- a/tempest/tests/compute/test_server_actions.py
+++ b/tempest/tests/compute/test_server_actions.py
@@ -205,9 +205,11 @@
'contents': base64.b64encode(file_contents)}]
try:
resp, rebuilt_server = self.client.rebuild(999,
- self.image_ref_alt, name=new_name,
- meta=meta, personality=personality,
- adminPass='rebuild')
+ self.image_ref_alt,
+ name=new_name,
+ meta=meta,
+ personality=personality,
+ adminPass='rebuild')
except exceptions.NotFound:
pass
else:
diff --git a/tempest/tests/compute/test_server_addresses.py b/tempest/tests/compute/test_server_addresses.py
index ca657c6..164548d 100644
--- a/tempest/tests/compute/test_server_addresses.py
+++ b/tempest/tests/compute/test_server_addresses.py
@@ -31,8 +31,8 @@
cls.name = rand_name('server')
resp, cls.server = cls.client.create_server(cls.name,
- cls.image_ref,
- cls.flavor_ref)
+ cls.image_ref,
+ cls.flavor_ref)
cls.client.wait_for_server_status(cls.server['id'], 'ACTIVE')
@classmethod
diff --git a/tempest/tests/compute/test_server_personality.py b/tempest/tests/compute/test_server_personality.py
index be60f40..e204130 100644
--- a/tempest/tests/compute/test_server_personality.py
+++ b/tempest/tests/compute/test_server_personality.py
@@ -34,15 +34,14 @@
name = rand_name('server')
file_contents = 'This is a test file.'
personality = []
- resp, max_file_limit = self.user_client.get_personality_file_limit()
+ _, max_file_limit = self.user_client.get_personality_file_limit()
for i in range(0, max_file_limit + 1):
path = 'etc/test' + str(i) + '.txt'
personality.append({'path': path,
'contents': base64.b64encode(file_contents)})
try:
- resp, resp_body = self.client.create_server(name, self.image_ref,
- self.flavor_ref,
- personality=personality)
+ self.client.create_server(name, self.image_ref, self.flavor_ref,
+ personality=personality)
except exceptions.OverLimit:
pass
else:
@@ -65,12 +64,14 @@
personality = []
for i in range(0, max_file_limit):
path = 'etc/test' + str(i) + '.txt'
- personality.append({'path': path,
- 'contents': base64.b64encode(file_contents)})
+ personality.append({
+ 'path': path,
+ 'contents': base64.b64encode(file_contents),
+ })
resp, server = self.client.create_server(name, self.image_ref,
- self.flavor_ref,
- personality=personality)
+ self.flavor_ref,
+ personality=personality)
self.assertEqual('202', resp['status'])
except Exception:
@@ -92,7 +93,7 @@
class ServerPersonalityTestJSON(base.BaseComputeTestJSON,
- ServerPersonalityTestBase):
+ ServerPersonalityTestBase):
@classmethod
def setUpClass(cls):
cls._interface = "json"
diff --git a/tempest/tests/compute/test_servers.py b/tempest/tests/compute/test_servers.py
index 18e92da..4132b02 100644
--- a/tempest/tests/compute/test_servers.py
+++ b/tempest/tests/compute/test_servers.py
@@ -33,8 +33,8 @@
try:
name = rand_name('server')
resp, server = self.client.create_server(name, self.image_ref,
- self.flavor_ref,
- adminPass='testpassword')
+ self.flavor_ref,
+ adminPass='testpassword')
#Verify the password is set correctly in the response
self.assertEqual('testpassword', server['adminPass'])
@@ -49,13 +49,13 @@
try:
server_name = rand_name('server')
resp, server = self.client.create_server(server_name,
- self.image_ref,
- self.flavor_ref)
+ self.image_ref,
+ self.flavor_ref)
self.client.wait_for_server_status(server['id'], 'ACTIVE')
id1 = server['id']
resp, server = self.client.create_server(server_name,
- self.image_ref,
- self.flavor_ref)
+ self.image_ref,
+ self.flavor_ref)
self.client.wait_for_server_status(server['id'], 'ACTIVE')
id2 = server['id']
self.assertNotEqual(id1, id2, "Did not create a new server")
@@ -79,9 +79,9 @@
resp, body = self.keypairs_client.list_keypairs()
server_name = rand_name('server')
resp, server = self.client.create_server(server_name,
- self.image_ref,
- self.flavor_ref,
- key_name=key_name)
+ self.image_ref,
+ self.flavor_ref,
+ key_name=key_name)
self.assertEqual('202', resp['status'])
self.client.wait_for_server_status(server['id'], 'ACTIVE')
resp, server = self.client.get_server(server['id'])
@@ -96,12 +96,12 @@
try:
name = rand_name('server')
resp, server = self.client.create_server(name, self.image_ref,
- self.flavor_ref)
+ self.flavor_ref)
self.client.wait_for_server_status(server['id'], 'ACTIVE')
#Update the server with a new name
resp, server = self.client.update_server(server['id'],
- name='newname')
+ name='newname')
self.assertEquals(200, resp.status)
self.client.wait_for_server_status(server['id'], 'ACTIVE')
@@ -121,13 +121,13 @@
try:
name = rand_name('server')
resp, server = self.client.create_server(name, self.image_ref,
- self.flavor_ref)
+ self.flavor_ref)
self.client.wait_for_server_status(server['id'], 'ACTIVE')
#Update the IPv4 and IPv6 access addresses
resp, body = self.client.update_server(server['id'],
- accessIPv4='1.1.1.1',
- accessIPv6='::babe:2.2.2.2')
+ accessIPv4='1.1.1.1',
+ accessIPv6='::babe:2.2.2.2')
self.assertEqual(200, resp.status)
self.client.wait_for_server_status(server['id'], 'ACTIVE')
@@ -144,7 +144,7 @@
"""Delete a server while it's VM state is Building"""
name = rand_name('server')
resp, server = self.client.create_server(name, self.image_ref,
- self.flavor_ref)
+ self.flavor_ref)
self.client.wait_for_server_status(server['id'], 'BUILD')
resp, _ = self.client.delete_server(server['id'])
self.assertEqual('204', resp['status'])
diff --git a/tempest/tests/compute/test_servers_negative.py b/tempest/tests/compute/test_servers_negative.py
index 2558e6d..3d16ce4 100644
--- a/tempest/tests/compute/test_servers_negative.py
+++ b/tempest/tests/compute/test_servers_negative.py
@@ -122,8 +122,8 @@
"""Reboot a deleted server"""
self.name = rand_name('server')
resp, create_server = self.client.create_server(self.name,
- self.image_ref,
- self.flavor_ref)
+ self.image_ref,
+ self.flavor_ref)
self.server_id = create_server['id']
self.client.delete_server(self.server_id)
self.client.wait_for_server_termination(self.server_id)
@@ -139,14 +139,14 @@
"""Rebuild a deleted server"""
self.name = rand_name('server')
resp, create_server = self.client.create_server(self.name,
- self.image_ref,
- self.flavor_ref)
+ self.image_ref,
+ self.flavor_ref)
self.server_id = create_server['id']
self.client.delete_server(self.server_id)
self.client.wait_for_server_termination(self.server_id)
try:
resp1, rebuild_server = self.client.rebuild(self.server_id,
- self.image_ref_alt)
+ self.image_ref_alt)
except exceptions.NotFound:
pass
else:
@@ -176,8 +176,8 @@
networks = [{'fixed_ip': '10.0.1.1', 'uuid':'a-b-c-d-e-f-g-h-i-j'}]
self.assertRaises(exceptions.BadRequest, self.client.create_server,
- server_name, self.image_ref, self.flavor_ref,
- networks=networks)
+ server_name, self.image_ref, self.flavor_ref,
+ networks=networks)
@attr(type='negative')
def test_create_with_non_existant_keypair(self):
@@ -186,8 +186,8 @@
key_name = rand_name('key')
server_name = rand_name('server')
self.assertRaises(exceptions.BadRequest, self.client.create_server,
- server_name, self.image_ref, self.flavor_ref,
- key_name=key_name)
+ server_name, self.image_ref, self.flavor_ref,
+ key_name=key_name)
@unittest.skip("Until Bug 1004007 is fixed")
@attr(type='negative')
@@ -197,8 +197,8 @@
server_name = rand_name('server')
metadata = {'a': 'b' * 260}
self.assertRaises(exceptions.OverLimit, self.client.create_server,
- server_name, self.image_ref, self.flavor_ref,
- meta=metadata)
+ server_name, self.image_ref, self.flavor_ref,
+ meta=metadata)
@attr(type='negative')
def test_update_name_of_non_existent_server(self):
@@ -208,7 +208,7 @@
new_name = rand_name('server') + '_updated'
self.assertRaises(exceptions.NotFound, self.client.update_server,
- server_name, name=new_name)
+ server_name, name=new_name)
@attr(type='negative')
def test_update_server_set_empty_name(self):
@@ -218,7 +218,7 @@
new_name = ''
self.assertRaises(exceptions.BadRequest, self.client.update_server,
- server_name, name=new_name)
+ server_name, name=new_name)
@attr(type='negative')
def test_update_server_of_another_tenant(self):
@@ -227,8 +227,8 @@
server = self.create_server()
new_name = server['id'] + '_new'
self.assertRaises(exceptions.NotFound,
- self.alt_client.update_server, server['id'],
- name=new_name)
+ self.alt_client.update_server, server['id'],
+ name=new_name)
@attr(type='negative')
def test_update_server_name_length_exceeds_256(self):
@@ -237,14 +237,16 @@
server = self.create_server()
new_name = 'a' * 256
self.assertRaises(exceptions.BadRequest,
- self.client.update_server, server['id'], name=new_name)
+ self.client.update_server,
+ server['id'],
+ name=new_name)
@attr(type='negative')
def test_delete_non_existent_server(self):
"""Delete a non existent server"""
self.assertRaises(exceptions.NotFound, self.client.delete_server,
- '999erra43')
+ '999erra43')
@attr(type='negative')
def test_delete_a_server_of_another_tenant(self):
@@ -261,8 +263,7 @@
def test_delete_server_pass_negative_id(self):
"""Pass an invalid string parameter to delete server"""
- self.assertRaises(exceptions.NotFound, self.client.delete_server,
- -1)
+ self.assertRaises(exceptions.NotFound, self.client.delete_server, -1)
@attr(type='negative')
def test_delete_server_pass_id_exceeding_length_limit(self):
diff --git a/tempest/tests/compute/test_servers_whitebox.py b/tempest/tests/compute/test_servers_whitebox.py
index b47b516..152b3f7 100644
--- a/tempest/tests/compute/test_servers_whitebox.py
+++ b/tempest/tests/compute/test_servers_whitebox.py
@@ -38,8 +38,10 @@
cls.connection, cls.meta = cls.get_db_handle_and_meta()
resp, tenants = cls.admin_client.list_tenants()
- cls.tenant_id = [tnt['id'] for tnt in tenants if tnt['name'] ==
- cls.config.compute.tenant_name][0]
+ cls.tenant_id = [
+ tnt['id']
+ for tnt in tenants if tnt['name'] == cls.config.compute.tenant_name
+ ][0]
cls.shared_server = cls.create_server()
@@ -62,8 +64,9 @@
if not result:
cores_hard_limit = 2
stmt = quotas.insert().values(deleted=0,
- project_id=self.tenant_id, resource='cores',
- hard_limit=cores_hard_limit)
+ project_id=self.tenant_id,
+ resource='cores',
+ hard_limit=cores_hard_limit)
self.connection.execute(stmt, autocommit=True)
else:
@@ -93,8 +96,9 @@
if not result:
ram_hard_limit = 1024
stmt = quotas.insert().values(deleted=0,
- project_id=self.tenant_id, resource='ram',
- hard_limit=ram_hard_limit)
+ project_id=self.tenant_id,
+ resource='ram',
+ hard_limit=ram_hard_limit)
self.connection.execute(stmt, autocommit=True)
else:
@@ -158,10 +162,11 @@
self.update_state(self.shared_server['id'], vm_state, task_state)
self.assertRaises(exceptions.Unauthorized,
- self.client.delete_server, self.shared_server['id'])
+ self.client.delete_server,
+ self.shared_server['id'])
except:
self.fail("Should not allow delete server when vm_state=%s and "
- "task_state=%s" % (vm_state, task_state))
+ "task_state=%s" % (vm_state, task_state))
finally:
self.update_state(self.shared_server['id'], 'active', None)
diff --git a/tempest/tests/compute/test_volumes_get.py b/tempest/tests/compute/test_volumes_get.py
index fcdec96..e80e5b9 100644
--- a/tempest/tests/compute/test_volumes_get.py
+++ b/tempest/tests/compute/test_volumes_get.py
@@ -37,9 +37,10 @@
self.assertTrue('id' in volume)
self.assertTrue('displayName' in volume)
self.assertEqual(volume['displayName'], v_name,
- "The created volume name is not equal to the requested name")
+ "The created volume name is not equal "
+ "to the requested name")
self.assertTrue(volume['id'] is not None,
- "Field volume id is empty or not found.")
+ "Field volume id is empty or not found.")
#Wait for Volume status to become ACTIVE
self.client.wait_for_volume_status(volume['id'], 'available')
#GET Volume
diff --git a/tempest/tests/identity/admin/test_roles.py b/tempest/tests/identity/admin/test_roles.py
index e0b180b..063efed 100644
--- a/tempest/tests/identity/admin/test_roles.py
+++ b/tempest/tests/identity/admin/test_roles.py
@@ -49,7 +49,7 @@
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)
+ self.non_admin_client.list_roles)
def test_list_roles_request_without_token(self):
"""Request to list roles without a valid token should fail"""
@@ -149,19 +149,19 @@
"""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'])
+ tenant['id'], 'junk-user-id-999', role['id'])
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')
+ tenant['id'], user['id'], 'junk-role-id-12345')
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'])
+ 'junk-tenant-1234', user['id'], role['id'])
def test_assign_duplicate_user_role(self):
"""Duplicate user role should not get assigned"""
@@ -186,8 +186,8 @@
user['id'],
role['id'])
self.assertRaises(exceptions.Unauthorized,
- self.non_admin_client.remove_user_role,
- tenant['id'], user['id'], role['id'])
+ self.non_admin_client.remove_user_role,
+ tenant['id'], user['id'], role['id'])
def test_remove_user_role_request_without_token(self):
"""Request to remove a user's role without a valid token"""
@@ -198,8 +198,8 @@
token = self.client.get_auth()
self.client.delete_token(token)
self.assertRaises(exceptions.Unauthorized,
- self.client.remove_user_role, tenant['id'],
- user['id'], role['id'])
+ self.client.remove_user_role, tenant['id'],
+ user['id'], role['id'])
self.client.clear_auth()
def test_remove_user_role_non_existant_user(self):
@@ -209,7 +209,7 @@
user['id'],
role['id'])
self.assertRaises(exceptions.NotFound, self.client.remove_user_role,
- tenant['id'], 'junk-user-id-123', role['id'])
+ tenant['id'], 'junk-user-id-123', role['id'])
def test_remove_user_role_non_existant_role(self):
"""Attempt to delete a non existent role from a user should fail"""
@@ -261,7 +261,7 @@
"""Attempt to list roles of a non existent user should fail"""
(user, tenant, role) = self._get_role_params()
self.assertRaises(exceptions.NotFound, self.client.list_user_roles,
- tenant['id'], 'junk-role-aabbcc11')
+ tenant['id'], 'junk-role-aabbcc11')
class UserRolesTestJSON(RolesTestJSON,
diff --git a/tempest/tests/identity/admin/test_services.py b/tempest/tests/identity/admin/test_services.py
index fa4178a..b8b99f7 100644
--- a/tempest/tests/identity/admin/test_services.py
+++ b/tempest/tests/identity/admin/test_services.py
@@ -66,8 +66,7 @@
service_data['id'])
-class ServicesTestJSON(base.BaseIdentityAdminTestJSON,
- ServicesTestBase):
+class ServicesTestJSON(base.BaseIdentityAdminTestJSON, ServicesTestBase):
@classmethod
def setUpClass(cls):
super(ServicesTestJSON, cls).setUpClass()
diff --git a/tempest/tests/identity/admin/test_tenants.py b/tempest/tests/identity/admin/test_tenants.py
index d8b6c33..00f37f2 100644
--- a/tempest/tests/identity/admin/test_tenants.py
+++ b/tempest/tests/identity/admin/test_tenants.py
@@ -42,7 +42,7 @@
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)
+ self.non_admin_client.list_tenants)
def test_list_tenant_request_without_token(self):
"""Request to list tenants without a valid token should fail"""
@@ -74,7 +74,7 @@
tenant_name = rand_name('tenant-')
resp, tenant = self.client.create_tenant(tenant_name)
self.assertRaises(exceptions.Unauthorized,
- self.non_admin_client.delete_tenant, tenant['id'])
+ self.non_admin_client.delete_tenant, tenant['id'])
def test_tenant_delete_request_without_token(self):
"""Request to delete a tenant without a valid token should fail"""
@@ -83,13 +83,13 @@
token = self.client.get_auth()
self.client.delete_token(token)
self.assertRaises(exceptions.Unauthorized, self.client.delete_tenant,
- tenant['id'])
+ tenant['id'])
self.client.clear_auth()
def test_delete_non_existent_tenant(self):
"""Attempt to delete a non existent tenant should fail"""
self.assertRaises(exceptions.NotFound, self.client.delete_tenant,
- 'junk_tenant_123456abc')
+ 'junk_tenant_123456abc')
def test_tenant_create_with_description(self):
"""Create tenant with a description"""
@@ -102,11 +102,11 @@
desc1 = body['description']
self.assertTrue(st1.startswith('2'))
self.assertEqual(desc1, tenant_desc, 'Description should have '
- 'been sent in response for create')
+ 'been sent in response for create')
resp, body = self.client.get_tenant(tenant_id)
desc2 = body['description']
self.assertEqual(desc2, tenant_desc, 'Description does not appear'
- 'to be set')
+ 'to be set')
self.client.delete_tenant(tenant_id)
def test_tenant_create_enabled(self):
@@ -158,7 +158,7 @@
"""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)
+ self.non_admin_client.create_tenant, tenant_name)
def test_create_tenant_request_without_token(self):
"""Create tenant request without a token should not be authorized"""
@@ -166,7 +166,7 @@
token = self.client.get_auth()
self.client.delete_token(token)
self.assertRaises(exceptions.Unauthorized, self.client.create_tenant,
- tenant_name)
+ tenant_name)
self.client.clear_auth()
def test_create_tenant_with_empty_name(self):
@@ -178,7 +178,7 @@
"""Tenant name length should not be greater than 64 characters"""
tenant_name = 'a' * 65
self.assertRaises(exceptions.BadRequest, self.client.create_tenant,
- tenant_name)
+ tenant_name)
def test_tenant_update_name(self):
"""Update name attribute of a tenant"""
diff --git a/tempest/tests/identity/admin/test_users.py b/tempest/tests/identity/admin/test_users.py
index 07c032e..43255dd 100644
--- a/tempest/tests/identity/admin/test_users.py
+++ b/tempest/tests/identity/admin/test_users.py
@@ -36,8 +36,8 @@
"""Create a user"""
self.data.setup_test_tenant()
resp, user = self.client.create_user(self.alt_user, self.alt_password,
- self.data.tenant['id'],
- self.alt_email)
+ self.data.tenant['id'],
+ self.alt_email)
self.data.users.append(user)
self.assertEqual('200', resp['status'])
self.assertEqual(self.alt_user, user['name'])
@@ -65,8 +65,8 @@
"""Length of user name filed should be restricted to 64 characters"""
self.data.setup_test_tenant()
self.assertRaises(exceptions.BadRequest, self.client.create_user,
- 'a' * 65, self.alt_password,
- self.data.tenant['id'], self.alt_email)
+ 'a' * 65, self.alt_password,
+ self.data.tenant['id'], self.alt_email)
@attr(type='negative')
def test_create_user_with_duplicate_name(self):
@@ -100,14 +100,14 @@
"""Email format should be validated while creating a user"""
self.data.setup_test_tenant()
self.assertRaises(exceptions.BadRequest, self.client.create_user,
- self.alt_user, '', self.data.tenant['id'], '12345')
+ self.alt_user, '', self.data.tenant['id'], '12345')
@attr(type='negative')
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)
+ self.alt_user, self.alt_password, '49ffgg99999',
+ self.alt_email)
@attr(type='negative')
def test_create_user_request_without_a_token(self):
@@ -129,8 +129,8 @@
"""Delete a user"""
self.data.setup_test_tenant()
resp, user = self.client.create_user('user_1234', self.alt_password,
- self.data.tenant['id'],
- self.alt_email)
+ self.data.tenant['id'],
+ self.alt_email)
resp, body = self.client.delete_user(user['id'])
self.assertEquals('204', resp['status'])
@@ -139,8 +139,8 @@
"""Non admin user should not be authorized to delete a user"""
self.data.setup_test_user()
self.assertRaises(exceptions.Unauthorized,
- self.non_admin_client.delete_user,
- self.data.user['id'])
+ self.non_admin_client.delete_user,
+ self.data.user['id'])
@attr(type='negative')
def test_delete_non_existant_user(self):
@@ -154,7 +154,7 @@
self.data.setup_test_user()
# Get a token
self.token_client.auth(self.data.test_user, self.data.test_password,
- self.data.test_tenant)
+ self.data.test_tenant)
# Re-auth
resp, body = self.token_client.auth(self.data.test_user,
self.data.test_password,
@@ -178,9 +178,9 @@
self.data.setup_test_user()
self.disable_tenant(self.data.test_tenant)
self.assertRaises(exceptions.Unauthorized, self.token_client.auth,
- self.data.test_user,
- self.data.test_password,
- self.data.test_tenant)
+ self.data.test_user,
+ self.data.test_password,
+ self.data.test_tenant)
@attr(type='negative')
@unittest.skip('Until Bug 988920 is fixed')
@@ -188,16 +188,16 @@
"""User's token for an invalid tenant should not be authenticated"""
self.data.setup_one_user()
self.assertRaises(exceptions.Unauthorized, self.token_client.auth,
- self.data.test_user,
- self.data.test_password,
- 'junktenant1234')
+ self.data.test_user,
+ self.data.test_password,
+ 'junktenant1234')
@attr(type='negative')
def test_authentication_with_invalid_username(self):
"""Non-existent user's token should not get authenticated"""
self.assertRaises(exceptions.Unauthorized, self.token_client.auth,
- 'junkuser123', self.data.test_password,
- self.data.test_tenant)
+ 'junkuser123', self.data.test_password,
+ self.data.test_tenant)
@attr(type='negative')
def test_authentication_with_invalid_password(self):
@@ -237,7 +237,7 @@
"""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)
+ self.non_admin_client.get_users)
@attr(type='negative')
def test_get_users_request_without_token(self):
@@ -254,13 +254,13 @@
user_ids = list()
fetched_user_ids = list()
resp, user1 = self.client.create_user('tenant_user1', 'password1',
- self.data.tenant['id'],
- 'user1@123')
+ self.data.tenant['id'],
+ 'user1@123')
user_ids.append(user1['id'])
self.data.users.append(user1)
resp, user2 = self.client.create_user('tenant_user2', 'password2',
- self.data.tenant['id'],
- 'user2@123')
+ self.data.tenant['id'],
+ 'user2@123')
user_ids.append(user2['id'])
self.data.users.append(user2)
#List of users for the respective tenant ID
@@ -289,8 +289,8 @@
user_ids.append(user['id'])
self.client.assign_user_role(tenant['id'], user['id'], role['id'])
resp, second_user = self.client.create_user('second_user', 'password1',
- self.data.tenant['id'],
- 'user1@123')
+ self.data.tenant['id'],
+ 'user1@123')
user_ids.append(second_user['id'])
self.data.users.append(second_user)
self.client.assign_user_role(tenant['id'], second_user['id'],
diff --git a/tempest/tests/identity/base.py b/tempest/tests/identity/base.py
index f397a5b..618b328 100644
--- a/tempest/tests/identity/base.py
+++ b/tempest/tests/identity/base.py
@@ -101,9 +101,9 @@
self.test_password = rand_name('pass_')
self.test_email = self.test_user + '@testmail.tm'
resp, self.user = self.client.create_user(self.test_user,
- self.test_password,
- self.tenant['id'],
- self.test_email)
+ self.test_password,
+ self.tenant['id'],
+ self.test_email)
self.users.append(self.user)
def setup_test_tenant(self):
diff --git a/tempest/tests/volume/base.py b/tempest/tests/volume/base.py
index 2e016d5..5b38dea 100644
--- a/tempest/tests/volume/base.py
+++ b/tempest/tests/volume/base.py
@@ -124,9 +124,10 @@
def create_volume(self, size=1, metadata={}):
"""Wrapper utility that returns a test volume"""
display_name = rand_name(self.__class__.__name__ + "-volume")
- resp, volume = self.volumes_client.create_volume(size=size,
- display_name=display_name,
- metdata=metadata)
+ cli_resp = self.volumes_client.create_volume(size=size,
+ display_name=display_name,
+ metdata=metadata)
+ resp, volume = cli_resp
self.volumes_client.wait_for_volume_status(volume['id'], 'available')
self.volumes.append(volume)
return volume
diff --git a/tempest/tests/volume/test_volumes_get.py b/tempest/tests/volume/test_volumes_get.py
index 03ecb5a..fa8e86e 100644
--- a/tempest/tests/volume/test_volumes_get.py
+++ b/tempest/tests/volume/test_volumes_get.py
@@ -38,9 +38,10 @@
self.assertTrue('id' in volume)
self.assertTrue('display_name' in volume)
self.assertEqual(volume['display_name'], v_name,
- "The created volume name is not equal to the requested name")
+ "The created volume name is not equal "
+ "to the requested name")
self.assertTrue(volume['id'] is not None,
- "Field volume id is empty or not found.")
+ "Field volume id is empty or not found.")
self.client.wait_for_volume_status(volume['id'], 'available')
# Get Volume information
resp, fetched_volume = self.client.get_volume(volume['id'])
diff --git a/tempest/whitebox.py b/tempest/whitebox.py
index 5978e92..2711903 100644
--- a/tempest/whitebox.py
+++ b/tempest/whitebox.py
@@ -154,8 +154,8 @@
#Todo(rohitk): Need to define host connection parameters in config
else:
client = self.get_ssh_connection(self.config.whitebox.api_host,
- self.config.whitebox.api_user,
- self.config.whitebox.api_passwd)
+ self.config.whitebox.api_user,
+ self.config.whitebox.api_passwd)
result = client.exec_command(cmd)
return result
diff --git a/tox.ini b/tox.ini
index ed72876..fe340c1 100644
--- a/tox.ini
+++ b/tox.ini
@@ -15,4 +15,4 @@
[testenv:pep8]
deps = pep8==1.3.3
-commands = pep8 --ignore=E121,E122,E123,E124,E125,E126,E127,E128 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack,kong .
+commands = pep8 --ignore=E121,E122,E123,E124,E125,E126,E127 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack,kong .