Merge "Add tools/tempest_coverage.py script."
diff --git a/run_tests.sh b/run_tests.sh
index 461ec2f..6b7ebec 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -77,11 +77,12 @@
echo "Running pep8 ..."
srcfiles="`find tempest -type f -name "*.py"`"
srcfiles+=" `find tools -type f -name "*.py"`"
+ srcfiles+=" `find stress -type f -name "*.py"`"
srcfiles+=" setup.py"
- ignore='--ignore=N4,E121,E122,E125,E126'
+ ignore='--ignore=E121,E122,E125,E126'
- ${wrapper} python tools/hacking.py ${ignore} ${srcfiles}
+ ${wrapper} python tools/hacking.py ${ignore} ${srcfiles}
}
function run_coverage_start {
diff --git a/stress/config.py b/stress/config.py
index 64091cd..ca86ce5 100755
--- a/stress/config.py
+++ b/stress/config.py
@@ -39,15 +39,15 @@
@property
def nova_logdir(self):
- """Directory containing log files on the compute nodes"""
+ """Directory containing log files on the compute nodes."""
return self.get("nova_logdir", None)
@property
def controller(self):
- """Controller host"""
+ """Controller host."""
return self.get("controller", None)
@property
def max_instances(self):
- """Maximum number of instances to create during test"""
+ """Maximum number of instances to create during test."""
return self.get("max_instances", 16)
diff --git a/stress/pending_action.py b/stress/pending_action.py
index 635d2cc..abfa74d 100644
--- a/stress/pending_action.py
+++ b/stress/pending_action.py
@@ -46,7 +46,7 @@
return False
def check_timeout(self):
- """Check for timeouts of TestCase actions"""
+ """Check for timeouts of TestCase actions."""
time_diff = time.time() - self._start_time
if time_diff > self._timeout:
self._logger.error('%s exceeded timeout of %d' %
@@ -76,7 +76,7 @@
self._target = target_server
def _check_for_status(self, state_string):
- """Check to see if the machine has transitioned states"""
+ """Check to see if the machine has transitioned states."""
t = time.time() # for debugging
target = self._target
_resp, body = self._manager.servers_client.get_server(target['id'])
diff --git a/stress/test_case.py b/stress/test_case.py
index fe510d5..d04ace0 100644
--- a/stress/test_case.py
+++ b/stress/test_case.py
@@ -25,5 +25,5 @@
self._logger = logging.getLogger(self.__class__.__name__)
def run(self, nova_manager, state_obj, *pargs, **kargs):
- """Nova API methods to call that would modify state of the cluster"""
+ """Nova API methods to call that would modify state of the cluster."""
return
diff --git a/stress/test_floating_ips.py b/stress/test_floating_ips.py
index 9d89510..97e4382 100755
--- a/stress/test_floating_ips.py
+++ b/stress/test_floating_ips.py
@@ -61,7 +61,7 @@
class VerifyChangeFloatingIp(pending_action.PendingAction):
- """Verify that floating ip was changed"""
+ """Verify that floating ip was changed."""
def __init__(self, manager, floating_ip, timeout, add=None):
super(VerifyChangeFloatingIp, self).__init__(manager, timeout=timeout)
self.floating_ip = floating_ip
diff --git a/stress/test_server_actions.py b/stress/test_server_actions.py
index 3b4e71c..a2032f0 100644
--- a/stress/test_server_actions.py
+++ b/stress/test_server_actions.py
@@ -27,7 +27,7 @@
class TestRebootVM(test_case.StressTestCase):
- """Reboot a server"""
+ """Reboot a server."""
def run(self, manager, state, *pargs, **kwargs):
"""
@@ -132,7 +132,7 @@
# This code needs to be tested against a cluster that supports resize.
#class TestResizeVM(test_case.StressTestCase):
-# """Resize a server (change flavors)"""
+# """Resize a server (change flavors)."""
#
# def run(self, manager, state, *pargs, **kwargs):
# """
@@ -193,7 +193,7 @@
# timeout=_timeout)
#
#class VerifyResizeVM(pending_action.PendingServerAction):
-# """Verify that resizing of a VM was successful"""
+# """Verify that resizing of a VM was successful."""
# States = enum('VERIFY_RESIZE_CHECK', 'ACTIVE_CHECK')
#
# def __init__(self, manager, state, created_server,
diff --git a/stress/test_servers.py b/stress/test_servers.py
index 9957cdb..e1cb4d1 100644
--- a/stress/test_servers.py
+++ b/stress/test_servers.py
@@ -96,7 +96,7 @@
class VerifyCreateVM(pending_action.PendingServerAction):
- """Verify that VM was built and is running"""
+ """Verify that VM was built and is running."""
def __init__(self, manager,
state,
created_server,
@@ -175,7 +175,7 @@
class VerifyKillActiveVM(pending_action.PendingServerAction):
- """Verify that server was destroyed"""
+ """Verify that server was destroyed."""
def retry(self):
"""
@@ -238,7 +238,7 @@
class TestUpdateVMName(test_case.StressTestCase):
- """Class to change the name of the active server"""
+ """Class to change the name of the active server."""
def run(self, manager, state, *pargs, **kwargs):
"""
Issue HTTP POST request to change the name of active server.
@@ -288,7 +288,7 @@
class VerifyUpdateVMName(pending_action.PendingServerAction):
- """Check that VM has new name"""
+ """Check that VM has new name."""
def retry(self):
"""
Check that VM has new name. Update local view of `state` to RUNNING.
diff --git a/stress/tests/floating_ips.py b/stress/tests/floating_ips.py
index d62e892..6a4452c 100755
--- a/stress/tests/floating_ips.py
+++ b/stress/tests/floating_ips.py
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-"""Stress test that associates/disasssociates floating ips"""
+"""Stress test that associates/disasssociates floating ips."""
from stress.basher import BasherAction
from stress.driver import *
diff --git a/stress/tests/hard_reboots.py b/stress/tests/hard_reboots.py
index f35c6de..fe57be1 100644
--- a/stress/tests/hard_reboots.py
+++ b/stress/tests/hard_reboots.py
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-"""Test that reboots random instances in a Nova cluster"""
+"""Test that reboots random instances in a Nova cluster."""
from stress.test_servers import *
diff --git a/stress/utils/util.py b/stress/utils/util.py
index f90796d..ec63b99 100644
--- a/stress/utils/util.py
+++ b/stress/utils/util.py
@@ -50,6 +50,6 @@
def enum(*sequential, **named):
- """Create auto-incremented enumerated types"""
+ """Create auto-incremented enumerated types."""
enums = dict(zip(sequential, range(len(sequential))), **named)
return type('Enum', (), enums)
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index c96fc4f..287ef56 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -303,7 +303,7 @@
return resp, resp_body
def wait_for_resource_deletion(self, id):
- """Waits for a resource to be deleted"""
+ """Waits for a resource to be deleted."""
start_time = int(time.time())
while True:
if self.is_resource_deleted(id):
diff --git a/tempest/common/ssh.py b/tempest/common/ssh.py
index 1b40ddc..151060f 100644
--- a/tempest/common/ssh.py
+++ b/tempest/common/ssh.py
@@ -48,7 +48,7 @@
self.buf_size = 1024
def _get_ssh_connection(self):
- """Returns an ssh connection to the specified host"""
+ """Returns an ssh connection to the specified host."""
_timeout = True
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(
@@ -79,7 +79,7 @@
return (time.time() - timeout) > start_time
def connect_until_closed(self):
- """Connect to the server and wait until connection is lost"""
+ """Connect to the server and wait until connection is lost."""
try:
ssh = self._get_ssh_connection()
_transport = ssh.get_transport()
@@ -137,7 +137,7 @@
return ''.join(out_data)
def test_connection_auth(self):
- """ Returns true if ssh can connect to server"""
+ """Returns true if ssh can connect to server."""
try:
connection = self._get_ssh_connection()
connection.close()
diff --git a/tempest/common/utils/data_utils.py b/tempest/common/utils/data_utils.py
index 951fb61..3a7661c 100644
--- a/tempest/common/utils/data_utils.py
+++ b/tempest/common/utils/data_utils.py
@@ -29,7 +29,7 @@
def build_url(host, port, api_version=None, path=None,
params=None, use_ssl=False):
- """Build the request URL from given host, port, path and parameters"""
+ """Build the request URL from given host, port, path and parameters."""
pattern = 'v\d\.\d'
if re.match(pattern, path):
@@ -59,7 +59,7 @@
def parse_image_id(image_ref):
- """Return the image id from a given image ref"""
+ """Return the image id from a given image ref."""
return image_ref.rsplit('/')[-1]
diff --git a/tempest/config.py b/tempest/config.py
index 2b0eb70..8233dd5 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -458,7 +458,7 @@
# TODO(jaypipes): Move this to a common utils (not data_utils...)
def singleton(cls):
- """Simple wrapper for classes that should only have a single instance"""
+ """Simple wrapper for classes that should only have a single instance."""
instances = {}
def getinstance():
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index c9e2f95..178c2f2 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -118,7 +118,7 @@
class SSHExecCommandFailed(TempestException):
- ''' Raised when remotely executed command returns nonzero status. '''
+ """Raised when remotely executed command returns nonzero status."""
message = ("Command '%(command)s', exit status: %(exit_status)d, "
"Error:\n%(strerror)s")
diff --git a/tempest/openstack/common/cfg.py b/tempest/openstack/common/cfg.py
index 25667a4..1bbfe6a 100644
--- a/tempest/openstack/common/cfg.py
+++ b/tempest/openstack/common/cfg.py
@@ -1417,7 +1417,7 @@
logger.log(lvl, "=" * 80)
def _sanitize(opt, value):
- """Obfuscate values of options declared secret"""
+ """Obfuscate values of options declared secret."""
return value if not opt.secret else '*' * len(str(value))
for opt_name in sorted(self._opts):
diff --git a/tempest/openstack/common/iniparser.py b/tempest/openstack/common/iniparser.py
index 2412844..b5cb604 100644
--- a/tempest/openstack/common/iniparser.py
+++ b/tempest/openstack/common/iniparser.py
@@ -100,15 +100,15 @@
self._assignment(key, value)
def assignment(self, key, value):
- """Called when a full assignment is parsed"""
+ """Called when a full assignment is parsed."""
raise NotImplementedError()
def new_section(self, section):
- """Called when a new section is started"""
+ """Called when a new section is started."""
raise NotImplementedError()
def comment(self, comment):
- """Called when a comment is parsed"""
+ """Called when a comment is parsed."""
pass
def error_invalid_assignment(self, line):
diff --git a/tempest/services/boto/__init__.py b/tempest/services/boto/__init__.py
index 58a2b37..1365435 100644
--- a/tempest/services/boto/__init__.py
+++ b/tempest/services/boto/__init__.py
@@ -35,8 +35,8 @@
auth_url=None, tenant_name=None,
*args, **kwargs):
- self.connection_timeout = config.boto.http_socket_timeout
- self.num_retries = config.boto.num_retries
+ self.connection_timeout = str(config.boto.http_socket_timeout)
+ self.num_retries = str(config.boto.num_retries)
self.build_timeout = config.boto.build_timeout
# We do not need the "path": "/token" part
if auth_url:
@@ -73,7 +73,7 @@
boto.config.set("Boto", "num_retries", retries)
def __getattr__(self, name):
- """Automatically creates methods for the allowed methods set"""
+ """Automatically creates methods for the allowed methods set."""
if name in self.ALLOWED_METHODS:
def func(self, *args, **kwargs):
with closing(self.get_connection()) as conn:
diff --git a/tempest/services/compute/json/flavors_client.py b/tempest/services/compute/json/flavors_client.py
index 1c8d4f3..56546de 100644
--- a/tempest/services/compute/json/flavors_client.py
+++ b/tempest/services/compute/json/flavors_client.py
@@ -53,7 +53,7 @@
def create_flavor(self, name, ram, vcpus, disk, ephemeral, flavor_id,
swap, rxtx):
- """Creates a new flavor or instance type"""
+ """Creates a new flavor or instance type."""
post_body = {
'name': name,
'ram': ram,
@@ -72,5 +72,5 @@
return resp, body['flavor']
def delete_flavor(self, flavor_id):
- """Deletes the given flavor"""
+ """Deletes the given flavor."""
return self.delete("flavors/%s" % str(flavor_id))
diff --git a/tempest/services/compute/json/floating_ips_client.py b/tempest/services/compute/json/floating_ips_client.py
index 15882c7..d73b8a9 100644
--- a/tempest/services/compute/json/floating_ips_client.py
+++ b/tempest/services/compute/json/floating_ips_client.py
@@ -29,7 +29,7 @@
self.service = self.config.compute.catalog_type
def list_floating_ips(self, params=None):
- """Returns a list of all floating IPs filtered by any parameters"""
+ """Returns a list of all floating IPs filtered by any parameters."""
url = 'os-floating-ips'
if params:
url += '?%s' % urllib.urlencode(params)
@@ -39,7 +39,7 @@
return resp, body['floating_ips']
def get_floating_ip_details(self, floating_ip_id):
- """Get the details of a floating IP"""
+ """Get the details of a floating IP."""
url = "os-floating-ips/%s" % str(floating_ip_id)
resp, body = self.get(url)
body = json.loads(body)
@@ -48,20 +48,20 @@
return resp, body['floating_ip']
def create_floating_ip(self):
- """Allocate a floating IP to the project"""
+ """Allocate a floating IP to the project."""
url = 'os-floating-ips'
resp, body = self.post(url, None, None)
body = json.loads(body)
return resp, body['floating_ip']
def delete_floating_ip(self, floating_ip_id):
- """Deletes the provided floating IP from the project"""
+ """Deletes the provided floating IP from the project."""
url = "os-floating-ips/%s" % str(floating_ip_id)
resp, body = self.delete(url)
return resp, body
def associate_floating_ip_to_server(self, floating_ip, server_id):
- """Associate the provided floating IP to a specific server"""
+ """Associate the provided floating IP to a specific server."""
url = "servers/%s/action" % str(server_id)
post_body = {
'addFloatingIp': {
@@ -74,7 +74,7 @@
return resp, body
def disassociate_floating_ip_from_server(self, floating_ip, server_id):
- """Disassociate the provided floating IP from a specific server"""
+ """Disassociate the provided floating IP from a specific server."""
url = "servers/%s/action" % str(server_id)
post_body = {
'removeFloatingIp': {
diff --git a/tempest/services/compute/json/hosts_client.py b/tempest/services/compute/json/hosts_client.py
index 517e230..dc3c524 100644
--- a/tempest/services/compute/json/hosts_client.py
+++ b/tempest/services/compute/json/hosts_client.py
@@ -11,7 +11,7 @@
self.service = self.config.compute.catalog_type
def list_hosts(self):
- """Lists all hosts"""
+ """Lists all hosts."""
url = 'os-hosts'
resp, body = self.get(url)
diff --git a/tempest/services/compute/json/images_client.py b/tempest/services/compute/json/images_client.py
index 452400a..376dafc 100644
--- a/tempest/services/compute/json/images_client.py
+++ b/tempest/services/compute/json/images_client.py
@@ -33,7 +33,7 @@
self.build_timeout = self.config.compute.build_timeout
def create_image(self, server_id, name, meta=None):
- """Creates an image of the original server"""
+ """Creates an image of the original server."""
post_body = {
'createImage': {
@@ -50,7 +50,7 @@
return resp, body
def list_images(self, params=None):
- """Returns a list of all images filtered by any parameters"""
+ """Returns a list of all images filtered by any parameters."""
url = 'images'
if params:
url += '?%s' % urllib.urlencode(params)
@@ -60,7 +60,7 @@
return resp, body['images']
def list_images_with_detail(self, params=None):
- """Returns a detailed list of images filtered by any parameters"""
+ """Returns a detailed list of images filtered by any parameters."""
url = 'images/detail'
if params:
url += '?%s' % urllib.urlencode(params)
@@ -70,13 +70,13 @@
return resp, body['images']
def get_image(self, image_id):
- """Returns the details of a single image"""
+ """Returns the details of a single image."""
resp, body = self.get("images/%s" % str(image_id))
body = json.loads(body)
return resp, body['image']
def delete_image(self, image_id):
- """Deletes the provided image"""
+ """Deletes the provided image."""
return self.delete("images/%s" % str(image_id))
def wait_for_image_resp_code(self, image_id, code):
@@ -110,13 +110,13 @@
raise exceptions.TimeoutException
def list_image_metadata(self, image_id):
- """Lists all metadata items for an image"""
+ """Lists all metadata items for an image."""
resp, body = self.get("images/%s/metadata" % str(image_id))
body = json.loads(body)
return resp, body['metadata']
def set_image_metadata(self, image_id, meta):
- """Sets the metadata for an image"""
+ """Sets the metadata for an image."""
post_body = json.dumps({'metadata': meta})
resp, body = self.put('images/%s/metadata' % str(image_id),
post_body, self.headers)
@@ -124,7 +124,7 @@
return resp, body['metadata']
def update_image_metadata(self, image_id, meta):
- """Updates the metadata for an image"""
+ """Updates the metadata for an image."""
post_body = json.dumps({'metadata': meta})
resp, body = self.post('images/%s/metadata' % str(image_id),
post_body, self.headers)
@@ -132,13 +132,13 @@
return resp, body['metadata']
def get_image_metadata_item(self, image_id, key):
- """Returns the value for a specific image metadata key"""
+ """Returns the value for a specific image metadata key."""
resp, body = self.get("images/%s/metadata/%s" % (str(image_id), key))
body = json.loads(body)
return resp, body['meta']
def set_image_metadata_item(self, image_id, key, meta):
- """Sets the value for a specific image metadata key"""
+ """Sets the value for a specific image metadata key."""
post_body = json.dumps({'meta': meta})
resp, body = self.put('images/%s/metadata/%s' % (str(image_id), key),
post_body, self.headers)
@@ -146,7 +146,7 @@
return resp, body['meta']
def delete_image_metadata_item(self, image_id, key):
- """Deletes a single image metadata key/value pair"""
+ """Deletes a single image metadata key/value pair."""
resp, body = self.delete("images/%s/metadata/%s" %
(str(image_id), key))
return resp, body
diff --git a/tempest/services/compute/json/quotas_client.py b/tempest/services/compute/json/quotas_client.py
index 2cc417f..543b015 100644
--- a/tempest/services/compute/json/quotas_client.py
+++ b/tempest/services/compute/json/quotas_client.py
@@ -28,7 +28,7 @@
self.service = self.config.compute.catalog_type
def get_quota_set(self, tenant_id):
- """List the quota set for a tenant"""
+ """List the quota set for a tenant."""
url = 'os-quota-sets/%s' % str(tenant_id)
resp, body = self.get(url)
diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py
index f2586e5..95f2831 100644
--- a/tempest/services/compute/json/security_groups_client.py
+++ b/tempest/services/compute/json/security_groups_client.py
@@ -30,7 +30,7 @@
self.service = self.config.compute.catalog_type
def list_security_groups(self, params=None):
- """List all security groups for a user"""
+ """List all security groups for a user."""
url = 'os-security-groups'
if params:
@@ -41,7 +41,7 @@
return resp, body['security_groups']
def get_security_group(self, security_group_id):
- """Get the details of a Security Group"""
+ """Get the details of a Security Group."""
url = "os-security-groups/%s" % str(security_group_id)
resp, body = self.get(url)
body = json.loads(body)
@@ -63,7 +63,7 @@
return resp, body['security_group']
def delete_security_group(self, security_group_id):
- """Deletes the provided Security Group"""
+ """Deletes the provided Security Group."""
return self.delete('os-security-groups/%s' % str(security_group_id))
def create_security_group_rule(self, parent_group_id, ip_proto, from_port,
@@ -93,5 +93,5 @@
return resp, body['security_group_rule']
def delete_security_group_rule(self, group_rule_id):
- """Deletes the provided Security Group rule"""
+ """Deletes the provided Security Group rule."""
return self.delete('os-security-group-rules/%s' % str(group_rule_id))
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index 2e34ef8..b832af0 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -110,17 +110,17 @@
return resp, body['server']
def get_server(self, server_id):
- """Returns the details of an existing server"""
+ """Returns the details of an existing server."""
resp, body = self.get("servers/%s" % str(server_id))
body = json.loads(body)
return resp, body['server']
def delete_server(self, server_id):
- """Deletes the given server"""
+ """Deletes the given server."""
return self.delete("servers/%s" % str(server_id))
def list_servers(self, params=None):
- """Lists all servers for a user"""
+ """Lists all servers for a user."""
url = 'servers'
if params:
@@ -131,7 +131,7 @@
return resp, body
def list_servers_with_detail(self, params=None):
- """Lists all servers in detail for a user"""
+ """Lists all servers in detail for a user."""
url = 'servers/detail'
if params:
@@ -142,7 +142,7 @@
return resp, body
def wait_for_server_status(self, server_id, status):
- """Waits for a server to reach a given status"""
+ """Waits for a server to reach a given status."""
resp, body = self.get_server(server_id)
server_status = body['status']
start = int(time.time())
@@ -165,7 +165,7 @@
raise exceptions.TimeoutException(message)
def wait_for_server_termination(self, server_id, ignore_error=False):
- """Waits for server to reach termination"""
+ """Waits for server to reach termination."""
start_time = int(time.time())
while True:
try:
@@ -183,20 +183,20 @@
time.sleep(self.build_interval)
def list_addresses(self, server_id):
- """Lists all addresses for a server"""
+ """Lists all addresses for a server."""
resp, body = self.get("servers/%s/ips" % str(server_id))
body = json.loads(body)
return resp, body['addresses']
def list_addresses_by_network(self, server_id, network_id):
- """Lists all addresses of a specific network type for a server"""
+ """Lists all addresses of a specific network type for a server."""
resp, body = self.get("servers/%s/ips/%s" %
(str(server_id), network_id))
body = json.loads(body)
return resp, body
def change_password(self, server_id, password):
- """Changes the root password for the server"""
+ """Changes the root password for the server."""
post_body = {
'changePassword': {
'adminPass': password,
@@ -208,7 +208,7 @@
post_body, self.headers)
def reboot(self, server_id, reboot_type):
- """Reboots a server"""
+ """Reboots a server."""
post_body = {
'reboot': {
'type': reboot_type,
@@ -221,7 +221,7 @@
def rebuild(self, server_id, image_ref, name=None, meta=None,
personality=None, adminPass=None, disk_config=None):
- """Rebuilds a server with a new image"""
+ """Rebuilds a server with a new image."""
post_body = {
'imageRef': image_ref,
}
@@ -264,7 +264,7 @@
return resp, body
def confirm_resize(self, server_id):
- """Confirms the flavor change for a server"""
+ """Confirms the flavor change for a server."""
post_body = {
'confirmResize': None,
}
@@ -275,7 +275,7 @@
return resp, body
def revert_resize(self, server_id):
- """Reverts a server back to its original flavor"""
+ """Reverts a server back to its original flavor."""
post_body = {
'revertResize': None,
}
@@ -286,7 +286,7 @@
return resp, body
def create_image(self, server_id, image_name):
- """Creates an image of the given server"""
+ """Creates an image of the given server."""
post_body = {
'createImage': {
'name': image_name,
@@ -345,7 +345,7 @@
post_body, self.headers)
def attach_volume(self, server_id, volume_id, device='/dev/vdz'):
- """Attaches a volume to a server instance"""
+ """Attaches a volume to a server instance."""
post_body = json.dumps({
'volumeAttachment': {
'volumeId': volume_id,
@@ -357,13 +357,13 @@
return resp, body
def detach_volume(self, server_id, volume_id):
- """Detaches a volume from a server instance"""
+ """Detaches a volume from a server instance."""
resp, body = self.delete('servers/%s/os-volume_attachments/%s' %
(server_id, volume_id))
return resp, body
def add_security_group(self, server_id, security_group_name):
- """Adds a security group to the server"""
+ """Adds a security group to the server."""
post_body = {
'addSecurityGroup': {
'name': security_group_name
@@ -374,7 +374,7 @@
post_body, self.headers)
def remove_security_group(self, server_id, security_group_name):
- """Removes a security group from the server"""
+ """Removes a security group from the server."""
post_body = {
'removeSecurityGroup': {
'name': security_group_name
@@ -385,7 +385,7 @@
post_body, self.headers)
def live_migrate_server(self, server_id, dest_host, use_block_migration):
- """ This should be called with administrator privileges """
+ """This should be called with administrator privileges ."""
migrate_params = {
"disk_over_commit": False,
@@ -409,7 +409,7 @@
return resp, body['servers']
def migrate_server(self, server_id):
- """Migrates a server to a new host"""
+ """Migrates a server to a new host."""
post_body = {'migrate': 'null'}
post_body = json.dumps(post_body)
resp, body = self.post('servers/%s/action' % server_id,
@@ -417,7 +417,7 @@
return resp, body
def confirm_migration(self, server_id):
- """Confirms the migration of a server"""
+ """Confirms the migration of a server."""
post_body = {'confirmResize': 'null'}
post_body = json.dumps(post_body)
resp, body = self.post('servers/%s/action' % server_id,
@@ -425,63 +425,63 @@
return resp, body
def lock_server(self, server_id):
- """Locks the given server"""
+ """Locks the given server."""
post_body = {'lock': 'null'}
post_body = json.dumps(post_body)
resp, body = self.post('servers/%s/action' % server_id,
post_body, self.headers)
def unlock_server(self, server_id):
- """UNlocks the given server"""
+ """UNlocks the given server."""
post_body = {'unlock': 'null'}
post_body = json.dumps(post_body)
resp, body = self.post('servers/%s/action' % server_id,
post_body, self.headers)
def start_server(self, server_id):
- """Starts the given server"""
+ """Starts the given server."""
post_body = {'os-start': 'null'}
post_body = json.dumps(post_body)
resp, body = self.post('servers/%s/action' % server_id,
post_body, self.headers)
def stop_server(self, server_id):
- """Stops the given server"""
+ """Stops the given server."""
post_body = {'os-stop': 'null'}
post_body = json.dumps(post_body)
resp, body = self.post('servers/%s/action' % server_id,
post_body, self.headers)
def suspend_server(self, server_id):
- """Suspends the provded server"""
+ """Suspends the provded server."""
post_body = {'suspend': 'null'}
post_body = json.dumps(post_body)
resp, body = self.post('servers/%s/action' % server_id,
post_body, self.headers)
def resume_server(self, server_id):
- """Un-suspends the provded server"""
+ """Un-suspends the provded server."""
post_body = {'resume': 'null'}
post_body = json.dumps(post_body)
resp, body = self.post('servers/%s/action' % server_id,
post_body, self.headers)
def pause_server(self, server_id):
- """Pauses the provded server"""
+ """Pauses the provded server."""
post_body = {'pause': 'null'}
post_body = json.dumps(post_body)
resp, body = self.post('servers/%s/action' % server_id,
post_body, self.headers)
def unpause_server(self, server_id):
- """Un-pauses the provded server"""
+ """Un-pauses the provded server."""
post_body = {'unpause': 'null'}
post_body = json.dumps(post_body)
resp, body = self.post('servers/%s/action' % server_id,
post_body, self.headers)
def reset_state(self, server_id, new_state='error'):
- """Resets the state of a server to active/error"""
+ """Resets the state of a server to active/error."""
post_body = {
'os-resetState': {
'state': new_state
diff --git a/tempest/services/compute/json/volumes_extensions_client.py b/tempest/services/compute/json/volumes_extensions_client.py
index 6cf6c23..a5f6ec3 100644
--- a/tempest/services/compute/json/volumes_extensions_client.py
+++ b/tempest/services/compute/json/volumes_extensions_client.py
@@ -34,7 +34,7 @@
self.build_timeout = self.config.volume.build_timeout
def list_volumes(self, params=None):
- """List all the volumes created"""
+ """List all the volumes created."""
url = 'os-volumes'
if params:
url += '?%s' % urllib.urlencode(params)
@@ -44,7 +44,7 @@
return resp, body['volumes']
def list_volumes_with_detail(self, params=None):
- """List all the details of volumes"""
+ """List all the details of volumes."""
url = 'os-volumes/detail'
if params:
url += '?%s' % urllib.urlencode(params)
@@ -54,7 +54,7 @@
return resp, body['volumes']
def get_volume(self, volume_id, wait=None):
- """Returns the details of a single volume"""
+ """Returns the details of a single volume."""
url = "os-volumes/%s" % str(volume_id)
resp, body = self.get(url, wait=wait)
body = json.loads(body)
@@ -80,11 +80,11 @@
return resp, body['volume']
def delete_volume(self, volume_id):
- """Deletes the Specified Volume"""
+ """Deletes the Specified Volume."""
return self.delete("os-volumes/%s" % str(volume_id))
def wait_for_volume_status(self, volume_id, status):
- """Waits for a Volume to reach a given status"""
+ """Waits for a Volume to reach a given status."""
resp, body = self.get_volume(volume_id)
volume_name = body['displayName']
volume_status = body['status']
diff --git a/tempest/services/compute/xml/flavors_client.py b/tempest/services/compute/xml/flavors_client.py
index 1dc34a5..2a8ad0d 100644
--- a/tempest/services/compute/xml/flavors_client.py
+++ b/tempest/services/compute/xml/flavors_client.py
@@ -86,7 +86,7 @@
def create_flavor(self, name, ram, vcpus, disk, ephemeral, flavor_id,
swap, rxtx):
- """Creates a new flavor or instance type"""
+ """Creates a new flavor or instance type."""
flavor = Element("flavor",
xmlns=XMLNS_11,
ram=ram,
@@ -105,5 +105,5 @@
return resp, flavor
def delete_flavor(self, flavor_id):
- """Deletes the given flavor"""
+ """Deletes the given flavor."""
return self.delete("flavors/%s" % str(flavor_id), self.headers)
diff --git a/tempest/services/compute/xml/floating_ips_client.py b/tempest/services/compute/xml/floating_ips_client.py
index a0059a8..74b4be2 100644
--- a/tempest/services/compute/xml/floating_ips_client.py
+++ b/tempest/services/compute/xml/floating_ips_client.py
@@ -42,7 +42,7 @@
return json
def list_floating_ips(self, params=None):
- """Returns a list of all floating IPs filtered by any parameters"""
+ """Returns a list of all floating IPs filtered by any parameters."""
url = 'os-floating-ips'
if params:
url += '?%s' % urllib.urlencode(params)
@@ -52,7 +52,7 @@
return resp, body
def get_floating_ip_details(self, floating_ip_id):
- """Get the details of a floating IP"""
+ """Get the details of a floating IP."""
url = "os-floating-ips/%s" % str(floating_ip_id)
resp, body = self.get(url, self.headers)
body = self._parse_floating_ip(etree.fromstring(body))
@@ -61,20 +61,20 @@
return resp, body
def create_floating_ip(self):
- """Allocate a floating IP to the project"""
+ """Allocate a floating IP to the project."""
url = 'os-floating-ips'
resp, body = self.post(url, None, self.headers)
body = self._parse_floating_ip(etree.fromstring(body))
return resp, body
def delete_floating_ip(self, floating_ip_id):
- """Deletes the provided floating IP from the project"""
+ """Deletes the provided floating IP from the project."""
url = "os-floating-ips/%s" % str(floating_ip_id)
resp, body = self.delete(url, self.headers)
return resp, body
def associate_floating_ip_to_server(self, floating_ip, server_id):
- """Associate the provided floating IP to a specific server"""
+ """Associate the provided floating IP to a specific server."""
url = "servers/%s/action" % str(server_id)
doc = Document()
server = Element("addFloatingIp")
@@ -84,7 +84,7 @@
return resp, body
def disassociate_floating_ip_from_server(self, floating_ip, server_id):
- """Disassociate the provided floating IP from a specific server"""
+ """Disassociate the provided floating IP from a specific server."""
url = "servers/%s/action" % str(server_id)
doc = Document()
server = Element("removeFloatingIp")
diff --git a/tempest/services/compute/xml/images_client.py b/tempest/services/compute/xml/images_client.py
index efed3fb..1e8b250 100644
--- a/tempest/services/compute/xml/images_client.py
+++ b/tempest/services/compute/xml/images_client.py
@@ -43,7 +43,7 @@
return self._parse_links(node, json)
def _parse_image(self, node):
- """Parses detailed XML image information into dictionary"""
+ """Parses detailed XML image information into dictionary."""
json = xml_to_json(node)
self._parse_links(node, json)
@@ -61,7 +61,7 @@
return json
def _parse_links(self, node, json):
- """Append multiple links under a list"""
+ """Append multiple links under a list."""
# look for links
if 'link' in json:
# remove single link element
@@ -71,7 +71,7 @@
return json
def create_image(self, server_id, name, meta=None):
- """Creates an image of the original server"""
+ """Creates an image of the original server."""
post_body = Element('createImage', name=name)
if meta:
@@ -86,7 +86,7 @@
return resp, body
def list_images(self, params=None):
- """Returns a list of all images filtered by any parameters"""
+ """Returns a list of all images filtered by any parameters."""
url = 'images'
if params:
url += '?%s' % urllib.urlencode(params)
@@ -96,7 +96,7 @@
return resp, body['images']
def list_images_with_detail(self, params=None):
- """Returns a detailed list of images filtered by any parameters"""
+ """Returns a detailed list of images filtered by any parameters."""
url = 'images/detail'
if params:
param_list = urllib.urlencode(params)
@@ -108,13 +108,13 @@
return resp, body['images']
def get_image(self, image_id):
- """Returns the details of a single image"""
+ """Returns the details of a single image."""
resp, body = self.get("images/%s" % str(image_id), self.headers)
body = self._parse_image(etree.fromstring(body))
return resp, body
def delete_image(self, image_id):
- """Deletes the provided image"""
+ """Deletes the provided image."""
return self.delete("images/%s" % str(image_id), self.headers)
def wait_for_image_resp_code(self, image_id, code):
@@ -147,14 +147,14 @@
raise exceptions.TimeoutException
def list_image_metadata(self, image_id):
- """Lists all metadata items for an image"""
+ """Lists all metadata items for an image."""
resp, body = self.get("images/%s/metadata" % str(image_id),
self.headers)
body = xml_to_json(etree.fromstring(body))
return resp, body['metadata']
def set_image_metadata(self, image_id, meta):
- """Sets the metadata for an image"""
+ """Sets the metadata for an image."""
post_body = json.dumps({'metadata': meta})
resp, body = self.put('images/%s/metadata' % str(image_id),
post_body, self.headers)
@@ -162,7 +162,7 @@
return resp, body['metadata']
def update_image_metadata(self, image_id, meta):
- """Updates the metadata for an image"""
+ """Updates the metadata for an image."""
post_body = Element('metadata', meta)
for k, v in meta:
metadata = Element('meta', key=k)
@@ -176,14 +176,14 @@
return resp, body['metadata']
def get_image_metadata_item(self, image_id, key):
- """Returns the value for a specific image metadata key"""
+ """Returns the value for a specific image metadata key."""
resp, body = self.get("images/%s/metadata/%s.xml" %
(str(image_id), key), self.headers)
body = xml_to_json(etree.fromstring(body))
return resp, body['meta']
def set_image_metadata_item(self, image_id, key, meta):
- """Sets the value for a specific image metadata key"""
+ """Sets the value for a specific image metadata key."""
post_body = json.dumps({'meta': meta})
resp, body = self.put('images/%s/metadata/%s' % (str(image_id), key),
post_body, self.headers)
@@ -191,7 +191,7 @@
return resp, body['meta']
def delete_image_metadata_item(self, image_id, key):
- """Deletes a single image metadata key/value pair"""
+ """Deletes a single image metadata key/value pair."""
resp, body = self.delete("images/%s/metadata/%s" % (str(image_id), key,
self.headers))
return resp, body
diff --git a/tempest/services/compute/xml/security_groups_client.py b/tempest/services/compute/xml/security_groups_client.py
index bfd6c7a..ac70f1b 100644
--- a/tempest/services/compute/xml/security_groups_client.py
+++ b/tempest/services/compute/xml/security_groups_client.py
@@ -44,7 +44,7 @@
return json
def list_security_groups(self, params=None):
- """List all security groups for a user"""
+ """List all security groups for a user."""
url = 'os-security-groups'
if params:
@@ -55,7 +55,7 @@
return resp, body
def get_security_group(self, security_group_id):
- """Get the details of a Security Group"""
+ """Get the details of a Security Group."""
url = "os-security-groups/%s" % str(security_group_id)
resp, body = self.get(url, self.headers)
body = self._parse_body(etree.fromstring(body))
@@ -78,7 +78,7 @@
return resp, body
def delete_security_group(self, security_group_id):
- """Deletes the provided Security Group"""
+ """Deletes the provided Security Group."""
return self.delete('os-security-groups/%s' %
str(security_group_id), self.headers)
@@ -125,6 +125,6 @@
return resp, body
def delete_security_group_rule(self, group_rule_id):
- """Deletes the provided Security Group rule"""
+ """Deletes the provided Security Group rule."""
return self.delete('os-security-group-rules/%s' %
str(group_rule_id), self.headers)
diff --git a/tempest/services/compute/xml/servers_client.py b/tempest/services/compute/xml/servers_client.py
index b33335d..4a84646 100644
--- a/tempest/services/compute/xml/servers_client.py
+++ b/tempest/services/compute/xml/servers_client.py
@@ -33,6 +33,69 @@
LOG = logging.getLogger(__name__)
+def _translate_ip_xml_json(ip):
+ """
+ Convert the address version to int.
+ """
+ ip = dict(ip)
+ version = ip.get('version')
+ if version:
+ ip['version'] = int(version)
+ return ip
+
+
+def _translate_network_xml_to_json(network):
+ return [_translate_ip_xml_json(ip.attrib)
+ for ip in network.findall('{%s}ip' % XMLNS_11)]
+
+
+def _translate_addresses_xml_to_json(xml_addresses):
+ return dict((network.attrib['id'], _translate_network_xml_to_json(network))
+ for network in xml_addresses.findall('{%s}network' % XMLNS_11))
+
+
+def _translate_server_xml_to_json(xml_dom):
+ """ Convert server XML to server JSON.
+
+ The addresses collection does not convert well by the dumb xml_to_json.
+ This method does some pre and post-processing to deal with that.
+
+ Translate XML addresses subtree to JSON.
+
+ Having xml_doc similar to
+ <api:server xmlns:api="http://docs.openstack.org/compute/api/v1.1">
+ <api:addresses>
+ <api:network id="foo_novanetwork">
+ <api:ip version="4" addr="192.168.0.4"/>
+ </api:network>
+ <api:network id="bar_novanetwork">
+ <api:ip version="4" addr="10.1.0.4"/>
+ <api:ip version="6" addr="2001:0:0:1:2:3:4:5"/>
+ </api:network>
+ </api:addresses>
+ </api:server>
+
+ the _translate_server_xml_to_json(etree.fromstring(xml_doc)) should produce
+ something like
+
+ {'addresses': {'bar_novanetwork': [{'addr': '10.1.0.4', 'version': 4},
+ {'addr': '2001:0:0:1:2:3:4:5',
+ 'version': 6}],
+ 'foo_novanetwork': [{'addr': '192.168.0.4', 'version': 4}]}}
+ """
+ nsmap = {'api': XMLNS_11}
+ addresses = xml_dom.xpath('/api:server/api:addresses', namespaces=nsmap)
+ if addresses:
+ if len(addresses) > 1:
+ raise ValueError('Expected only single `addresses` element.')
+ json_addresses = _translate_addresses_xml_to_json(addresses[0])
+ json = xml_to_json(xml_dom)
+ json['addresses'] = json_addresses
+ else:
+ json = xml_to_json(xml_dom)
+ return json
+
+
class ServersClientXML(RestClientXML):
def __init__(self, config, username, password, auth_url, tenant_name=None):
@@ -41,7 +104,7 @@
self.service = self.config.compute.catalog_type
def _parse_key_value(self, node):
- """Parse <foo key='key'>value</foo> data into {'key': 'value'}"""
+ """Parse <foo key='key'>value</foo> data into {'key': 'value'}."""
data = {}
for node in node.getchildren():
data[node.get('key')] = node.text
@@ -54,7 +117,8 @@
json['links'].append(xml_to_json(linknode))
def _parse_server(self, body):
- json = xml_to_json(body)
+ json = _translate_server_xml_to_json(body)
+
if 'metadata' in json and json['metadata']:
# NOTE(danms): if there was metadata, we need to re-parse
# that as a special type
@@ -65,17 +129,16 @@
for sub in ['image', 'flavor']:
if sub in json and 'link' in json[sub]:
self._parse_links(body, json[sub])
-
return json
def get_server(self, server_id):
- """Returns the details of an existing server"""
+ """Returns the details of an existing server."""
resp, body = self.get("servers/%s" % str(server_id), self.headers)
server = self._parse_server(etree.fromstring(body))
return resp, server
def delete_server(self, server_id):
- """Deletes the given server"""
+ """Deletes the given server."""
return self.delete("servers/%s" % str(server_id))
def _parse_array(self, node):
@@ -179,7 +242,7 @@
return resp, server
def wait_for_server_status(self, server_id, status):
- """Waits for a server to reach a given status"""
+ """Waits for a server to reach a given status."""
resp, body = self.get_server(server_id)
server_status = body['status']
start = int(time.time())
@@ -202,7 +265,7 @@
raise exceptions.TimeoutException(message)
def wait_for_server_termination(self, server_id, ignore_error=False):
- """Waits for server to reach termination"""
+ """Waits for server to reach termination."""
start_time = int(time.time())
while True:
try:
@@ -227,7 +290,7 @@
return {node.get('id'): addrs}
def list_addresses(self, server_id):
- """Lists all addresses for a server"""
+ """Lists all addresses for a server."""
resp, body = self.get("servers/%s/ips" % str(server_id), self.headers)
networks = {}
@@ -238,7 +301,7 @@
return resp, networks
def list_addresses_by_network(self, server_id, network_id):
- """Lists all addresses of a specific network type for a server"""
+ """Lists all addresses of a specific network type for a server."""
resp, body = self.get("servers/%s/ips/%s" % (str(server_id),
network_id),
self.headers)
diff --git a/tempest/services/compute/xml/volumes_extensions_client.py b/tempest/services/compute/xml/volumes_extensions_client.py
index 1e8c738..60ef398 100644
--- a/tempest/services/compute/xml/volumes_extensions_client.py
+++ b/tempest/services/compute/xml/volumes_extensions_client.py
@@ -54,7 +54,7 @@
return vol
def list_volumes(self, params=None):
- """List all the volumes created"""
+ """List all the volumes created."""
url = 'os-volumes'
if params:
@@ -68,7 +68,7 @@
return resp, volumes
def list_volumes_with_detail(self, params=None):
- """List all the details of volumes"""
+ """List all the details of volumes."""
url = 'os-volumes/detail'
if params:
@@ -82,7 +82,7 @@
return resp, volumes
def get_volume(self, volume_id, wait=None):
- """Returns the details of a single volume"""
+ """Returns the details of a single volume."""
url = "os-volumes/%s" % str(volume_id)
resp, body = self.get(url, self.headers, wait=wait)
body = etree.fromstring(body)
@@ -116,11 +116,11 @@
return resp, body
def delete_volume(self, volume_id):
- """Deletes the Specified Volume"""
+ """Deletes the Specified Volume."""
return self.delete("os-volumes/%s" % str(volume_id))
def wait_for_volume_status(self, volume_id, status):
- """Waits for a Volume to reach a given status"""
+ """Waits for a Volume to reach a given status."""
resp, body = self.get_volume(volume_id)
volume_name = body['displayName']
volume_status = body['status']
diff --git a/tempest/services/identity/json/admin_client.py b/tempest/services/identity/json/admin_client.py
index 7ea33b5..c4e6c95 100644
--- a/tempest/services/identity/json/admin_client.py
+++ b/tempest/services/identity/json/admin_client.py
@@ -25,7 +25,7 @@
return self._has_admin_extensions
def create_role(self, name):
- """Create a role"""
+ """Create a role."""
post_body = {
'name': name,
}
@@ -52,19 +52,19 @@
return resp, body['tenant']
def delete_role(self, role_id):
- """Delete a role"""
+ """Delete a role."""
resp, body = self.delete('OS-KSADM/roles/%s' % str(role_id))
return resp, body
def list_user_roles(self, tenant_id, user_id):
- """Returns a list of roles assigned to a user for a tenant"""
+ """Returns a list of roles assigned to a user for a tenant."""
url = '/tenants/%s/users/%s/roles' % (tenant_id, user_id)
resp, body = self.get(url)
body = json.loads(body)
return resp, body['roles']
def assign_user_role(self, tenant_id, user_id, role_id):
- """Add roles to a user on a tenant"""
+ """Add roles to a user on a tenant."""
post_body = json.dumps({})
resp, body = self.put('/tenants/%s/users/%s/roles/OS-KSADM/%s' %
(tenant_id, user_id, role_id), post_body,
@@ -73,29 +73,29 @@
return resp, body['role']
def remove_user_role(self, tenant_id, user_id, role_id):
- """Removes a role assignment for a user on a tenant"""
+ """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))
def delete_tenant(self, tenant_id):
- """Delete a tenant"""
+ """Delete a tenant."""
resp, body = self.delete('tenants/%s' % str(tenant_id))
return resp, body
def get_tenant(self, tenant_id):
- """Get tenant details"""
+ """Get tenant details."""
resp, body = self.get('tenants/%s' % str(tenant_id))
body = json.loads(body)
return resp, body['tenant']
def list_roles(self):
- """Returns roles"""
+ """Returns roles."""
resp, body = self.get('OS-KSADM/roles')
body = json.loads(body)
return resp, body['roles']
def list_tenants(self):
- """Returns tenants"""
+ """Returns tenants."""
resp, body = self.get('tenants')
body = json.loads(body)
return resp, body['tenants']
@@ -108,7 +108,7 @@
raise exceptions.NotFound('No such tenant')
def update_tenant(self, tenant_id, **kwargs):
- """Updates a tenant"""
+ """Updates a tenant."""
resp, body = self.get_tenant(tenant_id)
name = kwargs.get('name', body['name'])
desc = kwargs.get('description', body['description'])
@@ -126,7 +126,7 @@
return resp, body['tenant']
def create_user(self, name, password, tenant_id, email):
- """Create a user"""
+ """Create a user."""
post_body = {
'name': name,
'password': password,
@@ -139,18 +139,18 @@
return resp, body['user']
def delete_user(self, user_id):
- """Delete a user"""
+ """Delete a user."""
resp, body = self.delete("users/%s" % user_id)
return resp, body
def get_users(self):
- """Get the list of users"""
+ """Get the list of users."""
resp, body = self.get("users")
body = json.loads(body)
return resp, body['users']
def enable_disable_user(self, user_id, enabled):
- """Enables or disables a user"""
+ """Enables or disables a user."""
put_body = {
'enabled': enabled
}
@@ -161,12 +161,12 @@
return resp, body
def delete_token(self, token_id):
- """Delete a token"""
+ """Delete a token."""
resp, body = self.delete("tokens/%s" % token_id)
return resp, body
def list_users_for_tenant(self, tenant_id):
- """List users for a Tenant"""
+ """List users for a Tenant."""
resp, body = self.get('/tenants/%s/users' % tenant_id)
body = json.loads(body)
return resp, body['users']
@@ -179,7 +179,7 @@
raise exceptions.NotFound('No such user')
def create_service(self, name, type, **kwargs):
- """Create a service"""
+ """Create a service."""
post_body = {
'name': name,
'type': type,
@@ -191,14 +191,14 @@
return resp, body['OS-KSADM:service']
def get_service(self, service_id):
- """Get Service"""
+ """Get Service."""
url = '/OS-KSADM/services/%s' % service_id
resp, body = self.get(url)
body = json.loads(body)
return resp, body['OS-KSADM:service']
def delete_service(self, service_id):
- """Delete Service"""
+ """Delete Service."""
url = '/OS-KSADM/services/%s' % service_id
return self.delete(url)
diff --git a/tempest/services/identity/xml/admin_client.py b/tempest/services/identity/xml/admin_client.py
index 3a947b6..8448ae0 100644
--- a/tempest/services/identity/xml/admin_client.py
+++ b/tempest/services/identity/xml/admin_client.py
@@ -63,7 +63,7 @@
return self._has_admin_extensions
def create_role(self, name):
- """Create a role"""
+ """Create a role."""
create_role = Element("role", xmlns=XMLNS, name=name)
resp, body = self.post('OS-KSADM/roles', str(Document(create_role)),
self.headers)
@@ -89,55 +89,55 @@
return resp, body
def delete_role(self, role_id):
- """Delete a role"""
+ """Delete a role."""
resp, body = self.delete('OS-KSADM/roles/%s' % str(role_id),
self.headers)
return resp, body
def list_user_roles(self, tenant_id, user_id):
- """Returns a list of roles assigned to a user for a tenant"""
+ """Returns a list of roles assigned to a user for a tenant."""
url = '/tenants/%s/users/%s/roles' % (tenant_id, user_id)
resp, body = self.get(url, self.headers)
body = self._parse_array(etree.fromstring(body))
return resp, body
def assign_user_role(self, tenant_id, user_id, role_id):
- """Add roles to a user on a tenant"""
+ """Add roles to a user on a tenant."""
resp, body = self.put('/tenants/%s/users/%s/roles/OS-KSADM/%s' %
(tenant_id, user_id, role_id), '', self.headers)
body = self._parse_body(etree.fromstring(body))
return resp, body
def remove_user_role(self, tenant_id, user_id, role_id):
- """Removes a role assignment for a user on a tenant"""
+ """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)
def delete_tenant(self, tenant_id):
- """Delete a tenant"""
+ """Delete a tenant."""
resp, body = self.delete('tenants/%s' % str(tenant_id), self.headers)
return resp, body
def get_tenant(self, tenant_id):
- """Get tenant details"""
+ """Get tenant details."""
resp, body = self.get('tenants/%s' % str(tenant_id), self.headers)
body = self._parse_body(etree.fromstring(body))
return resp, body
def list_roles(self):
- """Returns roles"""
+ """Returns roles."""
resp, body = self.get('OS-KSADM/roles', self.headers)
body = self._parse_array(etree.fromstring(body))
return resp, body
def list_tenants(self):
- """Returns tenants"""
+ """Returns tenants."""
resp, body = self.get('tenants', self.headers)
body = self._parse_array(etree.fromstring(body))
return resp, body
def update_tenant(self, tenant_id, **kwargs):
- """Updates a tenant"""
+ """Updates a tenant."""
resp, body = self.get_tenant(tenant_id)
name = kwargs.get('name', body['name'])
desc = kwargs.get('description', body['description'])
@@ -156,7 +156,7 @@
return resp, body
def create_user(self, name, password, tenant_id, email):
- """Create a user"""
+ """Create a user."""
create_user = Element("user",
xmlns=XMLNS,
name=name,
@@ -169,18 +169,18 @@
return resp, body
def delete_user(self, user_id):
- """Delete a user"""
+ """Delete a user."""
resp, body = self.delete("users/%s" % user_id, self.headers)
return resp, body
def get_users(self):
- """Get the list of users"""
+ """Get the list of users."""
resp, body = self.get("users", self.headers)
body = self._parse_array(etree.fromstring(body))
return resp, body
def enable_disable_user(self, user_id, enabled):
- """Enables or disables a user"""
+ """Enables or disables a user."""
enable_user = Element("user", enabled=str(enabled).lower())
resp, body = self.put('users/%s/enabled' % user_id,
str(Document(enable_user)), self.headers)
@@ -188,18 +188,18 @@
return resp, body
def delete_token(self, token_id):
- """Delete a token"""
+ """Delete a token."""
resp, body = self.delete("tokens/%s" % token_id, self.headers)
return resp, body
def list_users_for_tenant(self, tenant_id):
- """List users for a Tenant"""
+ """List users for a Tenant."""
resp, body = self.get('/tenants/%s/users' % tenant_id, self.headers)
body = self._parse_array(etree.fromstring(body))
return resp, body
def create_service(self, name, type, **kwargs):
- """Create a service"""
+ """Create a service."""
OS_KSADM = "http://docs.openstack.org/identity/api/ext/OS-KSADM/v1.0"
create_service = Element("service",
xmlns=OS_KSADM,
@@ -213,14 +213,14 @@
return resp, body
def get_service(self, service_id):
- """Get Service"""
+ """Get Service."""
url = '/OS-KSADM/services/%s' % service_id
resp, body = self.get(url, self.headers)
body = self._parse_body(etree.fromstring(body))
return resp, body
def delete_service(self, service_id):
- """Delete Service"""
+ """Delete Service."""
url = '/OS-KSADM/services/%s' % service_id
return self.delete(url, self.headers)
diff --git a/tempest/services/object_storage/account_client.py b/tempest/services/object_storage/account_client.py
index 0ab5cd4..26f8329 100644
--- a/tempest/services/object_storage/account_client.py
+++ b/tempest/services/object_storage/account_client.py
@@ -40,7 +40,7 @@
def create_account_metadata(self, metadata,
metadata_prefix='X-Account-Meta-'):
- """Creates an account metadata entry"""
+ """Creates an account metadata entry."""
headers = {}
for key in metadata:
headers[metadata_prefix + key] = metadata[key]
diff --git a/tempest/services/object_storage/container_client.py b/tempest/services/object_storage/container_client.py
index 6b5342a..7b5efff 100644
--- a/tempest/services/object_storage/container_client.py
+++ b/tempest/services/object_storage/container_client.py
@@ -48,14 +48,14 @@
return resp, body
def delete_container(self, container_name):
- """Deletes the container (if it's empty)"""
+ """Deletes the container (if it's empty)."""
url = str(container_name)
resp, body = self.delete(url)
return resp, body
def update_container_metadata(self, container_name, metadata,
metadata_prefix='X-Container-Meta-'):
- """Updates arbitrary metadata on container"""
+ """Updates arbitrary metadata on container."""
url = str(container_name)
headers = {}
@@ -68,7 +68,7 @@
def delete_container_metadata(self, container_name, metadata,
metadata_prefix='X-Remove-Container-Meta-'):
- """Deletes arbitrary metadata on container"""
+ """Deletes arbitrary metadata on container."""
url = str(container_name)
headers = {}
diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py
index 0047b50..c05c905 100644
--- a/tempest/services/object_storage/object_client.py
+++ b/tempest/services/object_storage/object_client.py
@@ -30,25 +30,25 @@
self.service = self.config.object_storage.catalog_type
def create_object(self, container, object_name, data):
- """Create storage object"""
+ """Create storage object."""
url = "%s/%s" % (str(container), str(object_name))
resp, body = self.put(url, data, self.headers)
return resp, body
def update_object(self, container, object_name, data):
- """Upload data to replace current storage object"""
+ """Upload data to replace current storage object."""
return create_object(container, object_name, data)
def delete_object(self, container, object_name):
- """Delete storage object"""
+ """Delete storage object."""
url = "%s/%s" % (str(container), str(object_name))
resp, body = self.delete(url)
return resp, body
def update_object_metadata(self, container, object_name, metadata,
metadata_prefix='X-Object-Meta-'):
- """Add, remove, or change X-Object-Meta metadata for storage object"""
+ """Add, remove, or change X-Object-Meta metadata for storage object."""
headers = {}
for key in metadata:
@@ -59,7 +59,7 @@
return resp, body
def list_object_metadata(self, container, object_name):
- """List all storage object X-Object-Meta- metadata"""
+ """List all storage object X-Object-Meta- metadata."""
url = "%s/%s" % (str(container), str(object_name))
resp, body = self.head(url)
@@ -74,7 +74,7 @@
def copy_object_in_same_container(self, container, src_object_name,
dest_object_name, metadata=None):
- """Copy storage object's data to the new object using PUT"""
+ """Copy storage object's data to the new object using PUT."""
url = "{0}/{1}".format(container, dest_object_name)
headers = {}
@@ -91,7 +91,7 @@
def copy_object_across_containers(self, src_container, src_object_name,
dst_container, dst_object_name,
metadata=None):
- """Copy storage object's data to the new object using PUT"""
+ """Copy storage object's data to the new object using PUT."""
url = "{0}/{1}".format(dst_container, dst_object_name)
headers = {}
@@ -107,7 +107,7 @@
def copy_object_2d_way(self, container, src_object_name, dest_object_name,
metadata=None):
- """Copy storage object's data to the new object using COPY"""
+ """Copy storage object's data to the new object using COPY."""
url = "{0}/{1}".format(container, src_object_name)
headers = {}
@@ -161,7 +161,7 @@
return resp, body
def create_object(self, container, object_name, data, metadata=None):
- """Create storage object"""
+ """Create storage object."""
headers = {}
if metadata:
@@ -173,7 +173,7 @@
return resp, body
def delete_object(self, container, object_name):
- """Delete storage object"""
+ """Delete storage object."""
url = "%s/%s" % (str(container), str(object_name))
resp, body = self.delete(url)
diff --git a/tempest/services/volume/json/admin/volume_types_client.py b/tempest/services/volume/json/admin/volume_types_client.py
index fc8897f..0cadcb5 100644
--- a/tempest/services/volume/json/admin/volume_types_client.py
+++ b/tempest/services/volume/json/admin/volume_types_client.py
@@ -35,7 +35,7 @@
self.build_timeout = self.config.volume.build_timeout
def list_volume_types(self, params=None):
- """List all the volume_types created"""
+ """List all the volume_types created."""
url = 'types'
if params is not None:
url += '?%s' % urllib.urlencode(params)
@@ -45,7 +45,7 @@
return resp, body['volume_types']
def get_volume_type(self, volume_id):
- """Returns the details of a single volume_type"""
+ """Returns the details of a single volume_type."""
url = "types/%s" % str(volume_id)
resp, body = self.get(url)
body = json.loads(body)
@@ -69,11 +69,11 @@
return resp, body['volume_type']
def delete_volume_type(self, volume_id):
- """Deletes the Specified Volume_type"""
+ """Deletes the Specified Volume_type."""
return self.delete("types/%s" % str(volume_id))
def list_volume_types_extra_specs(self, vol_type_id, params=None):
- """List all the volume_types extra specs created"""
+ """List all the volume_types extra specs created."""
url = 'types/%s/extra_specs' % str(vol_type_id)
if params is not None:
url += '?%s' % urllib.urlencode(params)
@@ -83,7 +83,7 @@
return resp, body['extra_specs']
def get_volume_type_extra_specs(self, vol_type_id, extra_spec_name):
- """Returns the details of a single volume_type extra spec"""
+ """Returns the details of a single volume_type extra spec."""
url = "types/%s/extra_specs/%s" % (str(vol_type_id),
str(extra_spec_name))
resp, body = self.get(url)
@@ -103,7 +103,7 @@
return resp, body['extra_specs']
def delete_volume_type_extra_specs(self, vol_id, extra_spec_name):
- """Deletes the Specified Volume_type extra spec"""
+ """Deletes the Specified Volume_type extra spec."""
return self.delete("types/%s/extra_specs/%s" % ((str(vol_id)),
str(extra_spec_name)))
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index 962fe72..cc5a115 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -37,7 +37,7 @@
self.build_timeout = self.config.volume.build_timeout
def list_volumes(self, params=None):
- """List all the volumes created"""
+ """List all the volumes created."""
url = 'volumes'
if params:
url += '?%s' % urllib.urlencode(params)
@@ -47,7 +47,7 @@
return resp, body['volumes']
def list_volumes_with_detail(self, params=None):
- """List the details of all volumes"""
+ """List the details of all volumes."""
url = 'volumes/detail'
if params:
url += '?%s' % urllib.urlencode(params)
@@ -57,7 +57,7 @@
return resp, body['volumes']
def get_volume(self, volume_id, wait=None):
- """Returns the details of a single volume"""
+ """Returns the details of a single volume."""
url = "volumes/%s" % str(volume_id)
resp, body = self.get(url, wait=wait)
body = json.loads(body)
@@ -85,11 +85,11 @@
return resp, body['volume']
def delete_volume(self, volume_id):
- """Deletes the Specified Volume"""
+ """Deletes the Specified Volume."""
return self.delete("volumes/%s" % str(volume_id))
def attach_volume(self, volume_id, instance_uuid, mountpoint):
- """Attaches a volume to a given instance on a given mountpoint"""
+ """Attaches a volume to a given instance on a given mountpoint."""
post_body = {
'instance_uuid': instance_uuid,
'mountpoint': mountpoint,
@@ -100,7 +100,7 @@
return resp, body
def detach_volume(self, volume_id):
- """Detaches a volume from an instance"""
+ """Detaches a volume from an instance."""
post_body = {}
post_body = json.dumps({'os-detach': post_body})
url = 'volumes/%s/action' % (volume_id)
@@ -108,7 +108,7 @@
return resp, body
def wait_for_volume_status(self, volume_id, status):
- """Waits for a Volume to reach a given status"""
+ """Waits for a Volume to reach a given status."""
resp, body = self.get_volume(volume_id)
volume_name = body['display_name']
volume_status = body['status']
diff --git a/tempest/services/volume/xml/admin/volume_types_client.py b/tempest/services/volume/xml/admin/volume_types_client.py
index 3da1af0..74d4631 100644
--- a/tempest/services/volume/xml/admin/volume_types_client.py
+++ b/tempest/services/volume/xml/admin/volume_types_client.py
@@ -67,7 +67,7 @@
return extra_spec
def list_volume_types(self, params=None):
- """List all the volume_types created"""
+ """List all the volume_types created."""
url = 'types'
if params:
url += '?%s' % urllib.urlencode(params)
@@ -81,7 +81,7 @@
return resp, volume_types
def get_volume_type(self, type_id):
- """Returns the details of a single volume_type"""
+ """Returns the details of a single volume_type."""
url = "types/%s" % str(type_id)
resp, body = self.get(url, self.headers)
body = etree.fromstring(body)
@@ -114,11 +114,11 @@
return resp, body
def delete_volume_type(self, type_id):
- """Deletes the Specified Volume_type"""
+ """Deletes the Specified Volume_type."""
return self.delete("types/%s" % str(type_id))
def list_volume_types_extra_specs(self, vol_type_id, params=None):
- """List all the volume_types extra specs created"""
+ """List all the volume_types extra specs created."""
url = 'types/%s/extra_specs' % str(vol_type_id)
if params:
@@ -133,7 +133,7 @@
return resp, extra_specs
def get_volume_type_extra_specs(self, vol_type_id, extra_spec_name):
- """Returns the details of a single volume_type extra spec"""
+ """Returns the details of a single volume_type extra spec."""
url = "types/%s/extra_specs/%s" % (str(vol_type_id),
str(extra_spec_name))
resp, body = self.get(url, self.headers)
@@ -161,7 +161,7 @@
return resp, body
def delete_volume_type_extra_specs(self, vol_id, extra_spec_name):
- """Deletes the Specified Volume_type extra spec"""
+ """Deletes the Specified Volume_type extra spec."""
return self.delete("types/%s/extra_specs/%s" % ((str(vol_id)),
str(extra_spec_name)))
diff --git a/tempest/services/volume/xml/volumes_client.py b/tempest/services/volume/xml/volumes_client.py
index 91d0fc7..b0104e0 100644
--- a/tempest/services/volume/xml/volumes_client.py
+++ b/tempest/services/volume/xml/volumes_client.py
@@ -56,7 +56,7 @@
return vol
def list_volumes(self, params=None):
- """List all the volumes created"""
+ """List all the volumes created."""
url = 'volumes'
if params:
@@ -70,7 +70,7 @@
return resp, volumes
def list_volumes_with_detail(self, params=None):
- """List all the details of volumes"""
+ """List all the details of volumes."""
url = 'volumes/detail'
if params:
@@ -84,7 +84,7 @@
return resp, volumes
def get_volume(self, volume_id, wait=None):
- """Returns the details of a single volume"""
+ """Returns the details of a single volume."""
url = "volumes/%s" % str(volume_id)
resp, body = self.get(url, self.headers, wait=wait)
body = etree.fromstring(body)
@@ -116,11 +116,11 @@
return resp, body
def delete_volume(self, volume_id):
- """Deletes the Specified Volume"""
+ """Deletes the Specified Volume."""
return self.delete("volumes/%s" % str(volume_id))
def wait_for_volume_status(self, volume_id, status):
- """Waits for a Volume to reach a given status"""
+ """Waits for a Volume to reach a given status."""
resp, body = self.get_volume(volume_id)
volume_name = body['displayName']
volume_status = body['status']
diff --git a/tempest/testboto.py b/tempest/testboto.py
index 3a0eb25..c38bf99 100644
--- a/tempest/testboto.py
+++ b/tempest/testboto.py
@@ -122,7 +122,7 @@
class BotoTestCase(unittest.TestCase):
- """Recommended to use as base class for boto related test"""
+ """Recommended to use as base class for boto related test."""
@classmethod
def setUpClass(cls):
# The trash contains cleanup functions and paramaters in tuples
@@ -148,7 +148,7 @@
@classmethod
def cancelResourceCleanUp(cls, key):
- """Cancel Clean up request"""
+ """Cancel Clean up request."""
del cls._resource_trash_bin[key]
#TODO(afazekas): Add "with" context handling
@@ -293,7 +293,7 @@
@classmethod
def destroy_bucket(cls, connection_data, bucket):
- """Destroys the bucket and its content, just for teardown"""
+ """Destroys the bucket and its content, just for teardown."""
exc_num = 0
try:
with closing(boto.connect_s3(**connection_data)) as conn:
@@ -316,7 +316,7 @@
@classmethod
def destroy_reservation(cls, reservation):
- """Terminate instances in a reservation, just for teardown"""
+ """Terminate instances in a reservation, just for teardown."""
exc_num = 0
def _instance_state():
@@ -383,7 +383,7 @@
@classmethod
def destroy_snapshot_wait(cls, snapshot):
- """delete snaphot, wait until not exists"""
+ """delete snaphot, wait until not exists."""
snapshot.delete()
def _update():
diff --git a/tempest/tests/boto/test_ec2_instance_run.py b/tempest/tests/boto/test_ec2_instance_run.py
index 840d6dd..95ef23c 100644
--- a/tempest/tests/boto/test_ec2_instance_run.py
+++ b/tempest/tests/boto/test_ec2_instance_run.py
@@ -93,7 +93,7 @@
@attr(type='smoke')
def test_run_stop_terminate_instance(self):
- """EC2 run, stop and terminate instance"""
+ # EC2 run, stop and terminate instance
image_ami = self.ec2_client.get_image(self.images["ami"]
["image_id"])
reservation = image_ami.run(kernel_id=self.images["aki"]["image_id"],
@@ -122,7 +122,7 @@
@attr(type='smoke')
def test_run_terminate_instance(self):
- """EC2 run, terminate immediately"""
+ # EC2 run, terminate immediately
image_ami = self.ec2_client.get_image(self.images["ami"]
["image_id"])
reservation = image_ami.run(kernel_id=self.images["aki"]["image_id"],
@@ -139,7 +139,7 @@
# with normal validation it would fail
@attr("slow", type='smoke')
def test_integration_1(self):
- """EC2 1. integration test (not strict)"""
+ # EC2 1. integration test (not strict)
image_ami = self.ec2_client.get_image(self.images["ami"]["image_id"])
sec_group_name = rand_name("securitygroup-")
group_desc = sec_group_name + " security group description "
diff --git a/tempest/tests/boto/test_ec2_keys.py b/tempest/tests/boto/test_ec2_keys.py
index 162e2fb..fcec02d 100644
--- a/tempest/tests/boto/test_ec2_keys.py
+++ b/tempest/tests/boto/test_ec2_keys.py
@@ -39,7 +39,7 @@
@attr(type='smoke')
def test_create_ec2_keypair(self):
- """EC2 create KeyPair"""
+ # EC2 create KeyPair
key_name = rand_name("keypair-")
self.addResourceCleanUp(self.client.delete_key_pair, key_name)
keypair = self.client.create_key_pair(key_name)
@@ -49,7 +49,7 @@
@attr(type='smoke')
@unittest.skip("Skipped until the Bug #1072318 is resolved")
def test_delete_ec2_keypair(self):
- """EC2 delete KeyPair"""
+ # EC2 delete KeyPair
key_name = rand_name("keypair-")
self.client.create_key_pair(key_name)
self.client.delete_key_pair(key_name)
@@ -57,7 +57,7 @@
@attr(type='smoke')
def test_get_ec2_keypair(self):
- """EC2 get KeyPair"""
+ # EC2 get KeyPair
key_name = rand_name("keypair-")
self.addResourceCleanUp(self.client.delete_key_pair, key_name)
keypair = self.client.create_key_pair(key_name)
@@ -67,7 +67,7 @@
@attr(type='smoke')
@unittest.skip("Skipped until the Bug #1072762 is resolved")
def test_duplicate_ec2_keypair(self):
- """EC2 duplicate KeyPair"""
+ # EC2 duplicate KeyPair
key_name = rand_name("keypair-")
self.addResourceCleanUp(self.client.delete_key_pair, key_name)
keypair = self.client.create_key_pair(key_name)
diff --git a/tempest/tests/boto/test_ec2_network.py b/tempest/tests/boto/test_ec2_network.py
index c544b06..27649e6 100644
--- a/tempest/tests/boto/test_ec2_network.py
+++ b/tempest/tests/boto/test_ec2_network.py
@@ -35,7 +35,7 @@
@unittest.skip("Skipped until the Bug #1080406 is resolved")
@attr(type='smoke')
def test_disassociate_not_associated_floating_ip(self):
- """EC2 disassociate not associated floating ip"""
+ # EC2 disassociate not associated floating ip
ec2_codes = self.ec2_error_code
address = self.client.allocate_address()
public_ip = address.public_ip
diff --git a/tempest/tests/boto/test_ec2_security_groups.py b/tempest/tests/boto/test_ec2_security_groups.py
index c10f1df..09da82c 100644
--- a/tempest/tests/boto/test_ec2_security_groups.py
+++ b/tempest/tests/boto/test_ec2_security_groups.py
@@ -34,7 +34,7 @@
@attr(type='smoke')
def test_create_authorize_security_group(self):
- """EC2 Create, authorize/revoke security group"""
+ # EC2 Create, authorize/revoke security group
group_name = rand_name("securty_group-")
group_description = group_name + " security group description "
group = self.client.create_security_group(group_name,
diff --git a/tempest/tests/boto/test_ec2_volumes.py b/tempest/tests/boto/test_ec2_volumes.py
index 8d6cf6f..7898926 100644
--- a/tempest/tests/boto/test_ec2_volumes.py
+++ b/tempest/tests/boto/test_ec2_volumes.py
@@ -45,7 +45,7 @@
#NOTE(afazekas): as admin it can trigger the Bug #1074901
@attr(type='smoke')
def test_create_get_delete(self):
- """EC2 Create, get, delete Volume"""
+ # EC2 Create, get, delete Volume
volume = self.client.create_volume(1, self.zone)
cuk = self.addResourceCleanUp(self.client.delete_volume, volume.id)
self.assertIn(volume.status, self.valid_volume_status)
@@ -63,7 +63,7 @@
@attr(type='smoke')
def test_create_volme_from_snapshot(self):
- """EC2 Create volume from snapshot"""
+ # EC2 Create volume from snapshot
volume = self.client.create_volume(1, self.zone)
self.addResourceCleanUp(self.client.delete_volume, volume.id)
diff --git a/tempest/tests/boto/test_s3_buckets.py b/tempest/tests/boto/test_s3_buckets.py
index 5587673..beed28b 100644
--- a/tempest/tests/boto/test_s3_buckets.py
+++ b/tempest/tests/boto/test_s3_buckets.py
@@ -36,7 +36,7 @@
@unittest.skip("Skipped until the Bug #1076965 is resolved")
@attr(type='smoke')
def test_create_and_get_delete_bucket(self):
- """S3 Create, get and delete bucket"""
+ # S3 Create, get and delete bucket
bucket_name = rand_name("s3bucket-")
cleanup_key = self.addResourceCleanUp(self.client.delete_bucket,
bucket_name)
diff --git a/tempest/tests/boto/test_s3_ec2_images.py b/tempest/tests/boto/test_s3_ec2_images.py
index 7020f51..f14115a 100644
--- a/tempest/tests/boto/test_s3_ec2_images.py
+++ b/tempest/tests/boto/test_s3_ec2_images.py
@@ -62,7 +62,7 @@
# otherwise I would skip it too
@attr(type='smoke')
def test_register_get_deregister_ami_image(self):
- """Register and deregister ami image"""
+ # Register and deregister ami image
image = {"name": rand_name("ami-name-"),
"location": self.bucket_name + "/" + self.ami_manifest,
"type": "ami"}
@@ -90,7 +90,7 @@
@unittest.skip("Skipped until the Bug #1074904 is resolved")
def test_register_get_deregister_aki_image(self):
- """Register and deregister aki image"""
+ # Register and deregister aki image
image = {"name": rand_name("aki-name-"),
"location": self.bucket_name + "/" + self.ari_manifest,
"type": "aki"}
@@ -118,7 +118,7 @@
@unittest.skip("Skipped until the Bug #1074908 and #1074904 is resolved")
def test_register_get_deregister_ari_image(self):
- """Register and deregister ari image"""
+ # Register and deregister ari image
image = {"name": rand_name("ari-name-"),
"location": "/" + self.bucket_name + "/" + self.ari_manifest,
"type": "ari"}
diff --git a/tempest/tests/boto/test_s3_objects.py b/tempest/tests/boto/test_s3_objects.py
index 94b04dc..6e89539 100644
--- a/tempest/tests/boto/test_s3_objects.py
+++ b/tempest/tests/boto/test_s3_objects.py
@@ -40,7 +40,7 @@
@unittest.skip("Skipped until the Bug #1076534 is resolved")
@attr(type='smoke')
def test_create_get_delete_object(self):
- """S3 Create, get and delete object"""
+ # S3 Create, get and delete object
bucket_name = rand_name("s3bucket-")
object_name = rand_name("s3object-")
content = 'x' * 42
diff --git a/tempest/tests/boto/utils/wait.py b/tempest/tests/boto/utils/wait.py
index 951b5bf..77fe037 100644
--- a/tempest/tests/boto/utils/wait.py
+++ b/tempest/tests/boto/utils/wait.py
@@ -62,7 +62,7 @@
def re_search_wait(lfunction, regexp):
- """Stops waiting on success"""
+ """Stops waiting on success."""
start_time = time.time()
while True:
text = lfunction()
@@ -84,7 +84,7 @@
def wait_no_exception(lfunction, exc_class=None, exc_matcher=None):
- """Stops waiting on success"""
+ """Stops waiting on success."""
start_time = time.time()
if exc_matcher is not None:
exc_class = BotoServerError
@@ -114,7 +114,7 @@
#NOTE(afazekas): EC2/boto normally raise exception instead of empty list
def wait_exception(lfunction):
- """Returns with the exception or raises one"""
+ """Returns with the exception or raises one."""
start_time = time.time()
while True:
try:
diff --git a/tempest/tests/compute/admin/test_flavors.py b/tempest/tests/compute/admin/test_flavors.py
index e5de0cb..b5ee13a 100644
--- a/tempest/tests/compute/admin/test_flavors.py
+++ b/tempest/tests/compute/admin/test_flavors.py
@@ -47,8 +47,8 @@
@attr(type='positive')
def test_create_flavor(self):
- """Create a flavor and ensure it is listed
- This operation requires the user to have 'admin' role"""
+ # Create a flavor and ensure it is listed
+ # This operation requires the user to have 'admin' role
#Create the flavor
resp, flavor = self.client.create_flavor(self.flavor_name,
self.ram, self.vcpus,
@@ -77,8 +77,8 @@
@attr(type='positive')
def test_create_flavor_verify_entry_in_list_details(self):
- """Create a flavor and ensure it's details are listed
- This operation requires the user to have 'admin' role"""
+ # Create a flavor and ensure it's details are listed
+ # This operation requires the user to have 'admin' role
#Create the flavor
resp, flavor = self.client.create_flavor(self.flavor_name,
self.ram, self.vcpus,
@@ -101,7 +101,7 @@
@attr(type='negative')
def test_get_flavor_details_for_deleted_flavor(self):
- """Delete a flavor and ensure it is not listed"""
+ # Delete a flavor and ensure it is not listed
# Create a test flavor
resp, flavor = self.client.create_flavor(self.flavor_name,
self.ram,
diff --git a/tempest/tests/compute/admin/test_quotas.py b/tempest/tests/compute/admin/test_quotas.py
index b9474e5..452de80 100644
--- a/tempest/tests/compute/admin/test_quotas.py
+++ b/tempest/tests/compute/admin/test_quotas.py
@@ -66,7 +66,7 @@
@attr(type='smoke')
def test_get_default_quotas(self):
- """Admin can get the default resource quota set for a tenant"""
+ # Admin can get the default resource quota set for a tenant
expected_quota_set = self.default_quota_set.copy()
expected_quota_set['id'] = self.demo_tenant_id
try:
@@ -77,7 +77,7 @@
self.fail("Admin could not get the default quota set for a tenant")
def test_update_all_quota_resources_for_tenant(self):
- """Admin can update all the resource quota limits for a tenant"""
+ # Admin can update all the resource quota limits for a tenant
new_quota_set = {'injected_file_content_bytes': 20480,
'metadata_items': 256, 'injected_files': 10,
'ram': 10240, 'floating_ips': 20, 'key_pairs': 200,
@@ -102,7 +102,7 @@
"defaults")
def test_get_updated_quotas(self):
- """Verify that GET shows the updated quota set"""
+ # Verify that GET shows the updated quota set
self.adm_client.update_quota_set(self.demo_tenant_id,
ram='5120')
try:
@@ -120,7 +120,7 @@
"defaults")
def test_create_server_when_cpu_quota_is_full(self):
- """Disallow server creation when tenant's vcpu quota is full"""
+ # Disallow server creation when tenant's vcpu quota is full
resp, quota_set = self.client.get_quota_set(self.demo_tenant_id)
default_vcpu_quota = quota_set['cores']
vcpu_quota = 0 # Set the quota to zero to conserve resources
@@ -138,7 +138,7 @@
cores=default_vcpu_quota)
def test_create_server_when_memory_quota_is_full(self):
- """Disallow server creation when tenant's memory quota is full"""
+ # Disallow server creation when tenant's memory quota is full
resp, quota_set = self.client.get_quota_set(self.demo_tenant_id)
default_mem_quota = quota_set['ram']
mem_quota = 0 # Set the quota to zero to conserve resources
diff --git a/tempest/tests/compute/base.py b/tempest/tests/compute/base.py
index a79f7f5..e315d78 100644
--- a/tempest/tests/compute/base.py
+++ b/tempest/tests/compute/base.py
@@ -34,7 +34,7 @@
class BaseCompTest(unittest.TestCase):
- """Base test case class for all Compute API tests"""
+ """Base test case class for all Compute API tests."""
@classmethod
def setUpClass(cls):
@@ -179,7 +179,7 @@
@classmethod
def create_server(cls, image_id=None, flavor=None):
- """Wrapper utility that returns a test server"""
+ """Wrapper utility that returns a test server."""
server_name = rand_name(cls.__name__ + "-instance")
if not flavor:
@@ -212,7 +212,7 @@
return resp, server
def wait_for(self, condition):
- """Repeatedly calls condition() until a timeout"""
+ """Repeatedly calls condition() until a timeout."""
start_time = int(time.time())
while True:
try:
@@ -246,7 +246,7 @@
class BaseComputeAdminTest(unittest.TestCase):
- """Base test case class for all Compute Admin API tests"""
+ """Base test case class for all Compute Admin API tests."""
@classmethod
def setUpClass(cls):
diff --git a/tempest/tests/compute/flavors/test_flavors.py b/tempest/tests/compute/flavors/test_flavors.py
index 6423075..53cad65 100644
--- a/tempest/tests/compute/flavors/test_flavors.py
+++ b/tempest/tests/compute/flavors/test_flavors.py
@@ -24,7 +24,7 @@
@attr(type='smoke')
def test_list_flavors(self):
- """List of all flavors should contain the expected flavor"""
+ # List of all flavors should contain the expected flavor
resp, flavors = self.client.list_flavors()
resp, flavor = self.client.get_flavor_details(self.flavor_ref)
flavor_min_detail = {'id': flavor['id'], 'links': flavor['links'],
@@ -33,40 +33,40 @@
@attr(type='smoke')
def test_list_flavors_with_detail(self):
- """Detailed list of all flavors should contain the expected flavor"""
+ # Detailed list of all flavors should contain the expected flavor
resp, flavors = self.client.list_flavors_with_detail()
resp, flavor = self.client.get_flavor_details(self.flavor_ref)
self.assertTrue(flavor in flavors)
@attr(type='smoke')
def test_get_flavor(self):
- """The expected flavor details should be returned"""
+ # The expected flavor details should be returned
resp, flavor = self.client.get_flavor_details(self.flavor_ref)
self.assertEqual(self.flavor_ref, int(flavor['id']))
@attr(type='negative')
def test_get_non_existant_flavor(self):
- """flavor details are not returned for non existant flavors"""
+ # flavor details are not returned for non existant flavors
self.assertRaises(exceptions.NotFound, self.client.get_flavor_details,
999)
@attr(type='positive', bug='lp912922')
def test_list_flavors_limit_results(self):
- """Only the expected number of flavors should be returned"""
+ # Only the expected number of flavors should be returned
params = {'limit': 1}
resp, flavors = self.client.list_flavors(params)
self.assertEqual(1, len(flavors))
@attr(type='positive', bug='lp912922')
def test_list_flavors_detailed_limit_results(self):
- """Only the expected number of flavors (detailed) should be returned"""
+ # Only the expected number of flavors (detailed) should be returned
params = {'limit': 1}
resp, flavors = self.client.list_flavors_with_detail(params)
self.assertEqual(1, len(flavors))
@attr(type='positive')
def test_list_flavors_using_marker(self):
- """The list of flavors should start from the provided marker"""
+ # The list of flavors should start from the provided marker
resp, flavors = self.client.list_flavors()
flavor_id = flavors[0]['id']
@@ -77,7 +77,7 @@
@attr(type='positive')
def test_list_flavors_detailed_using_marker(self):
- """The list of flavors should start from the provided marker"""
+ # The list of flavors should start from the provided marker
resp, flavors = self.client.list_flavors_with_detail()
flavor_id = flavors[0]['id']
@@ -88,7 +88,7 @@
@attr(type='positive')
def test_list_flavors_detailed_filter_by_min_disk(self):
- """The detailed list of flavors should be filtered by disk space"""
+ # The detailed list of flavors should be filtered by disk space
resp, flavors = self.client.list_flavors_with_detail()
flavors = sorted(flavors, key=lambda k: k['disk'])
flavor_id = flavors[0]['id']
@@ -99,7 +99,7 @@
@attr(type='positive')
def test_list_flavors_detailed_filter_by_min_ram(self):
- """The detailed list of flavors should be filtered by RAM"""
+ # The detailed list of flavors should be filtered by RAM
resp, flavors = self.client.list_flavors_with_detail()
flavors = sorted(flavors, key=lambda k: k['ram'])
flavor_id = flavors[0]['id']
@@ -110,7 +110,7 @@
@attr(type='positive')
def test_list_flavors_filter_by_min_disk(self):
- """The list of flavors should be filtered by disk space"""
+ # The list of flavors should be filtered by disk space
resp, flavors = self.client.list_flavors_with_detail()
flavors = sorted(flavors, key=lambda k: k['disk'])
flavor_id = flavors[0]['id']
@@ -121,7 +121,7 @@
@attr(type='positive')
def test_list_flavors_filter_by_min_ram(self):
- """The list of flavors should be filtered by RAM"""
+ # The list of flavors should be filtered by RAM
resp, flavors = self.client.list_flavors_with_detail()
flavors = sorted(flavors, key=lambda k: k['ram'])
flavor_id = flavors[0]['id']
@@ -132,7 +132,7 @@
@attr(type='negative')
def test_get_flavor_details_for_invalid_flavor_id(self):
- """Ensure 404 returned for non-existant flavor ID"""
+ # Ensure 404 returned for non-existant flavor ID
self.assertRaises(exceptions.NotFound, self.client.get_flavor_details,
9999)
diff --git a/tempest/tests/compute/floating_ips/test_floating_ips_actions.py b/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
index 4e0efaa..9a9914a 100644
--- a/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/tests/compute/floating_ips/test_floating_ips_actions.py
@@ -63,10 +63,8 @@
@attr(type='positive')
def test_allocate_floating_ip(self):
- """
- Positive test:Allocation of a new floating IP to a project
- should be successful
- """
+ # Positive test:Allocation of a new floating IP to a project
+ # should be successful
try:
resp, body = self.client.create_floating_ip()
self.assertEqual(200, resp.status)
@@ -82,10 +80,8 @@
@attr(type='positive')
def test_delete_floating_ip(self):
- """
- Positive test:Deletion of valid floating IP from project
- should be successful
- """
+ # Positive test:Deletion of valid floating IP from project
+ # should be successful
#Creating the floating IP that is to be deleted in this method
resp, floating_ip_body = self.client.create_floating_ip()
#Storing the details of floating IP before deleting it
@@ -99,10 +95,9 @@
@attr(type='positive')
def test_associate_disassociate_floating_ip(self):
- """
- Positive test:Associate and disassociate the provided floating IP to a
- specific server should be successful
- """
+ # Positive test:Associate and disassociate the provided floating IP
+ # to a specific server should be successful
+
#Association of floating IP to fixed IP address
resp, body =\
self.client.associate_floating_ip_to_server(self.floating_ip,
@@ -116,11 +111,9 @@
@attr(type='negative')
def test_delete_nonexistant_floating_ip(self):
- """
+ # Negative test:Deletion of a nonexistent floating IP
+ # from project should fail
- Negative test:Deletion of a nonexistent floating IP
- from project should fail
- """
#Deleting the non existent floating IP
try:
resp, body = self.client.delete_floating_ip(self.non_exist_id)
@@ -131,10 +124,8 @@
@attr(type='negative')
def test_associate_nonexistant_floating_ip(self):
- """
- Negative test:Association of a non existent floating IP
- to specific server should fail
- """
+ # Negative test:Association of a non existent floating IP
+ # to specific server should fail
#Associating non existent floating IP
try:
resp, body = \
@@ -148,9 +139,7 @@
@attr(type='negative')
def test_dissociate_nonexistant_floating_ip(self):
- """
- Negative test:Dissociation of a non existent floating IP should fail
- """
+ # Negative test:Dissociation of a non existent floating IP should fail
#Dissociating non existent floating IP
try:
resp, body = \
@@ -164,10 +153,8 @@
@attr(type='positive')
def test_associate_already_associated_floating_ip(self):
- """
- positive test:Association of an already associated floating IP
- to specific server should change the association of the Floating IP
- """
+ # positive test:Association of an already associated floating IP
+ # to specific server should change the association of the Floating IP
#Create server so as to use for Multiple association
resp, body = self.servers_client.create_server('floating-server2',
self.image_ref,
@@ -205,10 +192,8 @@
@attr(type='negative')
def test_associate_ip_to_server_without_passing_floating_ip(self):
- """
- Negative test:Association of empty floating IP to specific server
- should raise NotFound exception
- """
+ # Negative test:Association of empty floating IP to specific server
+ # should raise NotFound exception
try:
resp, body =\
self.client.associate_floating_ip_to_server('',
diff --git a/tempest/tests/compute/floating_ips/test_list_floating_ips.py b/tempest/tests/compute/floating_ips/test_list_floating_ips.py
index 6f74f74..9eec27c 100644
--- a/tempest/tests/compute/floating_ips/test_list_floating_ips.py
+++ b/tempest/tests/compute/floating_ips/test_list_floating_ips.py
@@ -43,7 +43,7 @@
@attr(type='positive')
def test_list_floating_ips(self):
- """Positive test:Should return the list of floating IPs"""
+ # Positive test:Should return the list of floating IPs
resp, body = self.client.list_floating_ips()
self.assertEqual(200, resp.status)
floating_ips = body
@@ -54,7 +54,7 @@
@attr(type='positive')
def test_get_floating_ip_details(self):
- """Positive test:Should be able to GET the details of floatingIP"""
+ # Positive test:Should be able to GET the details of floatingIP
#Creating a floating IP for which details are to be checked
try:
resp, body = self.client.create_floating_ip()
@@ -78,10 +78,8 @@
@attr(type='negative')
def test_get_nonexistant_floating_ip_details(self):
- """
- Negative test:Should not be able to GET the details
- of nonexistant floating IP
- """
+ # Negative test:Should not be able to GET the details
+ # of nonexistant floating IP
floating_ip_id = []
resp, body = self.client.list_floating_ips()
for i in range(len(body)):
diff --git a/tempest/tests/compute/images/test_image_metadata.py b/tempest/tests/compute/images/test_image_metadata.py
index 1ac7de7..cdf4249 100644
--- a/tempest/tests/compute/images/test_image_metadata.py
+++ b/tempest/tests/compute/images/test_image_metadata.py
@@ -58,13 +58,13 @@
self.assertEqual(resp.status, 200)
def test_list_image_metadata(self):
- """All metadata key/value pairs for an image should be returned"""
+ # All metadata key/value pairs for an image should be returned
resp, resp_metadata = self.client.list_image_metadata(self.image_id)
expected = {'key1': 'value1', 'key2': 'value2'}
self.assertEqual(expected, resp_metadata)
def test_set_image_metadata(self):
- """The metadata for the image should match the new values"""
+ # The metadata for the image should match the new values
req_metadata = {'meta2': 'value2', 'meta3': 'value3'}
resp, body = self.client.set_image_metadata(self.image_id,
req_metadata)
@@ -73,7 +73,7 @@
self.assertEqual(req_metadata, resp_metadata)
def test_update_image_metadata(self):
- """The metadata for the image should match the updated values"""
+ # The metadata for the image should match the updated values
req_metadata = {'key1': 'alt1', 'key3': 'value3'}
resp, metadata = self.client.update_image_metadata(self.image_id,
req_metadata)
@@ -83,15 +83,14 @@
self.assertEqual(expected, resp_metadata)
def test_get_image_metadata_item(self):
- """The value for a specific metadata key should be returned"""
+ # The value for a specific metadata key should be returned
resp, meta = self.client.get_image_metadata_item(self.image_id,
'key2')
self.assertTrue('value2', meta['key2'])
def test_set_image_metadata_item(self):
- """
- The value provided for the given meta item should be set for the image
- """
+ # The value provided for the given meta item should be set for
+ # the image
meta = {'key1': 'alt'}
resp, body = self.client.set_image_metadata_item(self.image_id,
'key1', meta)
@@ -100,7 +99,7 @@
self.assertEqual(expected, resp_metadata)
def test_delete_image_metadata_item(self):
- """The metadata value/key pair should be deleted from the image"""
+ # The metadata value/key pair should be deleted from the image
resp, body = self.client.delete_image_metadata_item(self.image_id,
'key1')
resp, resp_metadata = self.client.list_image_metadata(self.image_id)
@@ -109,8 +108,8 @@
@attr(type='negative')
def test_list_nonexistant_image_metadata(self):
- """Negative test: List on nonexistant image
- metadata should not happen"""
+ # Negative test: List on nonexistant image
+ # metadata should not happen
try:
resp, resp_metadata = self.client.list_image_metadata(999)
except exceptions.NotFound:
@@ -121,7 +120,7 @@
@attr(type='negative')
def test_update_nonexistant_image_metadata(self):
- """Negative test:An update should not happen for a nonexistant image"""
+ # Negative test:An update should not happen for a nonexistant image
meta = {'key1': 'alt1', 'key2': 'alt2'}
try:
resp, metadata = self.client.update_image_metadata(999, meta)
@@ -132,7 +131,7 @@
@attr(type='negative')
def test_get_nonexistant_image_metadata_item(self):
- """Negative test: Get on nonexistant image should not happen"""
+ # Negative test: Get on nonexistant image should not happen
try:
resp, metadata = self.client.get_image_metadata_item(999, 'key2')
except exceptions.NotFound:
@@ -142,7 +141,7 @@
@attr(type='negative')
def test_set_nonexistant_image_metadata(self):
- """Negative test: Metadata should not be set to a nonexistant image"""
+ # Negative test: Metadata should not be set to a nonexistant image
meta = {'key1': 'alt1', 'key2': 'alt2'}
try:
resp, meta = self.client.set_image_metadata(999, meta)
@@ -153,8 +152,8 @@
@attr(type='negative')
def test_set_nonexistant_image_metadata_item(self):
- """Negative test: Metadata item should not be set to a
- nonexistant image"""
+ # Negative test: Metadata item should not be set to a
+ # nonexistant image
meta = {'key1': 'alt'}
try:
resp, body = self.client.set_image_metadata_item(999, 'key1', meta)
@@ -166,8 +165,8 @@
@attr(type='negative')
def test_delete_nonexistant_image_metadata_item(self):
- """Negative test: Shouldnt be able to delete metadata
- item from nonexistant image"""
+ # Negative test: Shouldnt be able to delete metadata
+ # item from nonexistant image
try:
resp, body = self.client.delete_image_metadata_item(999, 'key1')
resp, metadata = self.client.list_image_metadata(999)
diff --git a/tempest/tests/compute/images/test_images.py b/tempest/tests/compute/images/test_images.py
index 5c07626..6ebcbbc 100644
--- a/tempest/tests/compute/images/test_images.py
+++ b/tempest/tests/compute/images/test_images.py
@@ -31,7 +31,7 @@
class ImagesTestBase(object):
def tearDown(self):
- """Terminate test instances created after a test is executed"""
+ """Terminate test instances created after a test is executed."""
for server in self.servers:
resp, body = self.servers_client.delete_server(server['id'])
if resp['status'] == '204':
@@ -46,7 +46,7 @@
@unittest.skipUnless(compute.CREATE_IMAGE_ENABLED,
'Environment unable to create images.')
def test_create_delete_image(self):
- """An image for the provided server should be created"""
+ # An image for the provided server should be created
server_name = rand_name('server')
resp, server = self.servers_client.create_server(server_name,
self.image_ref,
@@ -77,7 +77,7 @@
@attr(type='negative')
def test_create_image_from_deleted_server(self):
- """An image should not be created if the server instance is removed """
+ # An image should not be created if the server instance is removed
server_name = rand_name('server')
resp, server = self.servers_client.create_server(server_name,
self.image_ref,
@@ -105,7 +105,7 @@
@attr(type='negative')
def test_create_image_from_invalid_server(self):
- """An image should not be created with invalid server id"""
+ # An image should not be created with invalid server id
try:
# Create a new image with invalid server id
name = rand_name('image')
@@ -127,7 +127,7 @@
@attr(type='negative')
@unittest.skipUnless(compute.MULTI_USER, 'Second user not configured')
def test_create_image_for_server_in_another_tenant(self):
- """Creating image of another tenant's server should be return error"""
+ # Creating image of another tenant's server should be return error
server = self.create_server()
snapshot_name = rand_name('test-snap-')
@@ -136,7 +136,7 @@
@attr(type='negative')
def test_create_image_when_server_is_building(self):
- """Return error when creating an image of a server that is building"""
+ # 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,
@@ -149,7 +149,7 @@
@unittest.skip("Until Bug 1039739 is fixed")
@attr(type='negative')
def test_create_image_when_server_is_rebooting(self):
- """Return error when creating an image of server that is rebooting"""
+ # Return error when creating an image of server that is rebooting
server = self.create_server()
self.servers_client.reboot(server['id'], 'HARD')
@@ -159,7 +159,7 @@
@attr(type='negative')
def test_create_image_when_server_is_terminating(self):
- """Return an error when creating image of server that is terminating"""
+ # Return an error when creating image of server that is terminating
server = self.create_server()
self.servers_client.delete_server(server['id'])
@@ -169,7 +169,7 @@
@attr(type='negative')
def test_create_second_image_when_first_image_is_being_saved(self):
- """Disallow creating another image when first image is being saved"""
+ # Disallow creating another image when first image is being saved
server = self.create_server()
try:
@@ -192,7 +192,7 @@
@attr(type='negative')
@unittest.skip("Until Bug 1004564 is fixed")
def test_create_image_specify_name_over_256_chars(self):
- """Return an error if snapshot name over 256 characters is passed"""
+ # Return an error if snapshot name over 256 characters is passed
server = self.create_server()
try:
@@ -205,7 +205,7 @@
@attr(type='negative')
def test_create_image_specify_uuid_35_characters_or_less(self):
- """Return an error if Image ID passed is 35 characters or less"""
+ # Return an error if Image ID passed is 35 characters or less
try:
snapshot_name = rand_name('test-snap-')
test_uuid = ('a' * 35)
@@ -217,7 +217,7 @@
@attr(type='negative')
def test_create_image_specify_uuid_37_characters_or_more(self):
- """Return an error if Image ID passed is 37 characters or more"""
+ # Return an error if Image ID passed is 37 characters or more
try:
snapshot_name = rand_name('test-snap-')
test_uuid = ('a' * 37)
@@ -230,7 +230,7 @@
@attr(type='negative')
@unittest.skip("Until Bug 1006725 is fixed")
def test_create_image_specify_multibyte_character_image_name(self):
- """Return an error if the image name has multi-byte characters"""
+ # Return an error if the image name has multi-byte characters
server = self.create_server()
try:
@@ -245,7 +245,7 @@
@attr(type='negative')
@unittest.skip("Until Bug 1005423 is fixed")
def test_create_image_specify_invalid_metadata(self):
- """Return an error when creating image with invalid metadata"""
+ # Return an error when creating image with invalid metadata
server = self.create_server()
try:
@@ -260,7 +260,7 @@
@attr(type='negative')
@unittest.skip("Until Bug 1005423 is fixed")
def test_create_image_specify_metadata_over_limits(self):
- """Return an error when creating image with meta data over 256 chars"""
+ # Return an error when creating image with meta data over 256 chars
server = self.create_server()
try:
@@ -274,7 +274,7 @@
@attr(type='negative')
def test_delete_image_with_invalid_image_id(self):
- """An image should not be deleted with invalid image id"""
+ # An image should not be deleted with invalid image id
try:
# Delete an image with invalid image id
resp, _ = self.client.delete_image('!@$%^&*()')
@@ -288,7 +288,7 @@
@attr(type='negative')
def test_delete_non_existent_image(self):
- """Return an error while trying to delete a non-existent image"""
+ # Return an error while trying to delete a non-existent image
non_existent_image_id = '11a22b9-12a9-5555-cc11-00ab112223fa'
self.assertRaises(exceptions.NotFound, self.client.delete_image,
@@ -296,7 +296,7 @@
@attr(type='negative')
def test_delete_image_blank_id(self):
- """Return an error while trying to delete an image with blank Id"""
+ # Return an error while trying to delete an image with blank Id
try:
self.assertRaises(exceptions.NotFound, self.client.delete_image,
@@ -306,7 +306,7 @@
@attr(type='negative')
def test_delete_image_non_hex_string_id(self):
- """Return an error while trying to delete an image with non hex id"""
+ # Return an error while trying to delete an image with non hex id
image_id = '11a22b9-120q-5555-cc11-00ab112223gj'
try:
@@ -317,7 +317,7 @@
@attr(type='negative')
def test_delete_image_negative_image_id(self):
- """Return an error while trying to delete an image with negative id"""
+ # Return an error while trying to delete an image with negative id
try:
self.assertRaises(exceptions.NotFound, self.client.delete_image,
@@ -327,7 +327,7 @@
@attr(type='negative')
def test_delete_image_id_is_over_35_character_limit(self):
- """Return an error while trying to delete image with id over limit"""
+ # Return an error while trying to delete image with id over limit
try:
self.assertRaises(exceptions.NotFound, self.client.delete_image,
@@ -339,7 +339,7 @@
@attr(type='negative')
@unittest.skipUnless(compute.MULTI_USER, 'Second user not configured')
def test_delete_image_of_another_tenant(self):
- """Return an error while trying to delete another tenant's image"""
+ # Return an error while trying to delete another tenant's image
server = self.create_server()
@@ -356,7 +356,7 @@
@attr(type='negative')
def test_delete_image_that_is_not_yet_active(self):
- """Return an error while trying to delete an active that is creating"""
+ # Return an error while trying to delete an active that is creating
server = self.create_server()
diff --git a/tempest/tests/compute/images/test_images_whitebox.py b/tempest/tests/compute/images/test_images_whitebox.py
index c2a5b05..2987534 100644
--- a/tempest/tests/compute/images/test_images_whitebox.py
+++ b/tempest/tests/compute/images/test_images_whitebox.py
@@ -36,7 +36,7 @@
@classmethod
def tearDownClass(cls):
- """Terminate test instances created after a test is executed"""
+ """Terminate test instances created after a test is executed."""
for server in cls.servers:
cls.update_state(server['id'], "active", None)
@@ -51,7 +51,7 @@
@classmethod
def update_state(self, server_id, vm_state, task_state, deleted=False):
- """Update states of an instance in database for validation"""
+ """Update states of an instance in database for validation."""
if not task_state:
task_state = "NULL"
@@ -64,7 +64,7 @@
self.connection.execute(stmt, autocommit=True)
def _test_create_image_409_base(self, vm_state, task_state, deleted=False):
- """Base method for create image tests based on vm and task states"""
+ """Base method for create image tests based on vm and task states."""
try:
self.update_state(self.shared_server['id'], vm_state,
task_state, deleted)
@@ -80,89 +80,89 @@
self.update_state(self.shared_server['id'], 'active', None)
def test_create_image_when_vm_eq_building_task_eq_scheduling(self):
- """409 error when instance states are building,scheduling"""
+ # 409 error when instance states are building,scheduling
self._test_create_image_409_base("building", "scheduling")
def test_create_image_when_vm_eq_building_task_eq_networking(self):
- """409 error when instance states are building,networking"""
+ # 409 error when instance states are building,networking
self._test_create_image_409_base("building", "networking")
def test_create_image_when_vm_eq_building_task_eq_bdm(self):
- """409 error when instance states are building,block_device_mapping"""
+ # 409 error when instance states are building,block_device_mapping
self._test_create_image_409_base("building", "block_device_mapping")
def test_create_image_when_vm_eq_building_task_eq_spawning(self):
- """409 error when instance states are building,spawning"""
+ # 409 error when instance states are building,spawning
self._test_create_image_409_base("building", "spawning")
def test_create_image_when_vm_eq_active_task_eq_image_backup(self):
- """409 error when instance states are active,image_backup"""
+ # 409 error when instance states are active,image_backup
self._test_create_image_409_base("active", "image_backup")
def test_create_image_when_vm_eq_resized_task_eq_resize_prep(self):
- """409 error when instance states are resized,resize_prep"""
+ # 409 error when instance states are resized,resize_prep
self._test_create_image_409_base("resized", "resize_prep")
def test_create_image_when_vm_eq_resized_task_eq_resize_migrating(self):
- """409 error when instance states are resized,resize_migrating"""
+ # 409 error when instance states are resized,resize_migrating
self._test_create_image_409_base("resized", "resize_migrating")
def test_create_image_when_vm_eq_resized_task_eq_resize_migrated(self):
- """409 error when instance states are resized,resize_migrated"""
+ # 409 error when instance states are resized,resize_migrated
self._test_create_image_409_base("resized", "resize_migrated")
def test_create_image_when_vm_eq_resized_task_eq_resize_finish(self):
- """409 error when instance states are resized,resize_finish"""
+ # 409 error when instance states are resized,resize_finish
self._test_create_image_409_base("resized", "resize_finish")
def test_create_image_when_vm_eq_resized_task_eq_resize_reverting(self):
- """409 error when instance states are resized,resize_reverting"""
+ # 409 error when instance states are resized,resize_reverting
self._test_create_image_409_base("resized", "resize_reverting")
def test_create_image_when_vm_eq_resized_task_eq_resize_confirming(self):
- """409 error when instance states are resized,resize_confirming"""
+ # 409 error when instance states are resized,resize_confirming
self._test_create_image_409_base("resized", "resize_confirming")
def test_create_image_when_vm_eq_active_task_eq_resize_verify(self):
- """409 error when instance states are active,resize_verify"""
+ # 409 error when instance states are active,resize_verify
self._test_create_image_409_base("active", "resize_verify")
def test_create_image_when_vm_eq_active_task_eq_updating_password(self):
- """409 error when instance states are active,updating_password"""
+ # 409 error when instance states are active,updating_password
self._test_create_image_409_base("active", "updating_password")
def test_create_image_when_vm_eq_active_task_eq_rebuilding(self):
- """409 error when instance states are active,rebuilding"""
+ # 409 error when instance states are active,rebuilding
self._test_create_image_409_base("active", "rebuilding")
def test_create_image_when_vm_eq_active_task_eq_rebooting(self):
- """409 error when instance states are active,rebooting"""
+ # 409 error when instance states are active,rebooting
self._test_create_image_409_base("active", "rebooting")
def test_create_image_when_vm_eq_building_task_eq_deleting(self):
- """409 error when instance states are building,deleting"""
+ # 409 error when instance states are building,deleting
self._test_create_image_409_base("building", "deleting")
def test_create_image_when_vm_eq_active_task_eq_deleting(self):
- """409 error when instance states are active,deleting"""
+ # 409 error when instance states are active,deleting
self._test_create_image_409_base("active", "deleting")
def test_create_image_when_vm_eq_error_task_eq_building(self):
- """409 error when instance states are error,building"""
+ # 409 error when instance states are error,building
self._test_create_image_409_base("error", "building")
def test_create_image_when_vm_eq_error_task_eq_none(self):
- """409 error when instance states are error,None"""
+ # 409 error when instance states are error,None
self._test_create_image_409_base("error", None)
def test_create_image_when_vm_eq_deleted_task_eq_none(self):
- """409 error when instance states are deleted,None"""
+ # 409 error when instance states are deleted,None
self._test_create_image_409_base("deleted", None)
def test_create_image_when_vm_eq_resized_task_eq_none(self):
- """409 error when instance states are resized,None"""
+ # 409 error when instance states are resized,None
self._test_create_image_409_base("resized", None)
def test_create_image_when_vm_eq_error_task_eq_resize_prep(self):
- """409 error when instance states are error,resize_prep"""
+ # 409 error when instance states are error,resize_prep
self._test_create_image_409_base("error", "resize_prep")
diff --git a/tempest/tests/compute/images/test_list_image_filters.py b/tempest/tests/compute/images/test_list_image_filters.py
index fd19369..26119e3 100644
--- a/tempest/tests/compute/images/test_list_image_filters.py
+++ b/tempest/tests/compute/images/test_list_image_filters.py
@@ -77,15 +77,14 @@
@attr(type='negative')
def test_get_image_not_existing(self):
- """Check raises a NotFound"""
+ # Check raises a NotFound
self.assertRaises(exceptions.NotFound, self.client.get_image,
"nonexistingimageid")
@attr(type='positive')
def test_list_images_filter_by_status(self):
- """
- The list of images should contain only images with the provided status
- """
+ # The list of images should contain only images with the
+ # provided status
params = {'status': 'ACTIVE'}
resp, images = self.client.list_images(params)
@@ -95,9 +94,8 @@
@attr(type='positive')
def test_list_images_filter_by_name(self):
- """
- List of all images should contain the expected images filtered by name
- """
+ # List of all images should contain the expected images filtered
+ # by name
params = {'name': self.image1['name']}
resp, images = self.client.list_images(params)
@@ -107,7 +105,7 @@
@attr(type='positive')
def test_list_images_filter_by_server_id(self):
- """The images should contain images filtered by server id"""
+ # The images should contain images filtered by server id
params = {'server': self.server1['id']}
resp, images = self.client.list_images(params)
@@ -119,7 +117,7 @@
@attr(type='positive')
def test_list_images_filter_by_server_ref(self):
- """The list of servers should be filtered by server ref"""
+ # The list of servers should be filtered by server ref
server_links = self.server2['links']
# Try all server link types
@@ -136,7 +134,7 @@
@attr(type='positive')
def test_list_images_filter_by_type(self):
- """The list of servers should be filtered by image type"""
+ # The list of servers should be filtered by image type
params = {'type': 'snapshot'}
resp, images = self.client.list_images(params)
@@ -147,14 +145,14 @@
@attr(type='positive')
def test_list_images_limit_results(self):
- """Verify only the expected number of results are returned"""
+ # Verify only the expected number of results are returned
params = {'limit': '1'}
resp, images = self.client.list_images(params)
self.assertEqual(1, len(images))
@attr(type='positive')
def test_list_images_filter_by_changes_since(self):
- """Verify only updated images are returned in the detailed list"""
+ # Verify only updated images are returned in the detailed list
#Becoming ACTIVE will modify the updated time
#Filter by the image's created time
@@ -165,10 +163,8 @@
@attr(type='positive')
def test_list_images_with_detail_filter_by_status(self):
- """
- Detailed list of all images should only contain images
- with the provided status
- """
+ # Detailed list of all images should only contain images
+ # with the provided status
params = {'status': 'ACTIVE'}
resp, images = self.client.list_images_with_detail(params)
@@ -178,10 +174,8 @@
@attr(type='positive')
def test_list_images_with_detail_filter_by_name(self):
- """
- Detailed list of all images should contain the expected
- images filtered by name
- """
+ # Detailed list of all images should contain the expected
+ # images filtered by name
params = {'name': self.image1['name']}
resp, images = self.client.list_images_with_detail(params)
@@ -191,17 +185,15 @@
@attr(type='positive')
def test_list_images_with_detail_limit_results(self):
- """
- Verify only the expected number of results (with full details)
- are returned
- """
+ # Verify only the expected number of results (with full details)
+ # are returned
params = {'limit': '1'}
resp, images = self.client.list_images_with_detail(params)
self.assertEqual(1, len(images))
@attr(type='positive')
def test_list_images_with_detail_filter_by_server_ref(self):
- """Detailed list of servers should be filtered by server ref"""
+ # Detailed list of servers should be filtered by server ref
server_links = self.server2['links']
# Try all server link types
@@ -218,7 +210,7 @@
@attr(type='positive')
def test_list_images_with_detail_filter_by_type(self):
- """The detailed list of servers should be filtered by image type"""
+ # The detailed list of servers should be filtered by image type
params = {'type': 'snapshot'}
resp, images = self.client.list_images_with_detail(params)
resp, image4 = self.client.get_image(self.image_ref)
@@ -230,7 +222,7 @@
@attr(type='positive')
def test_list_images_with_detail_filter_by_changes_since(self):
- """Verify an update image is returned"""
+ # Verify an update image is returned
#Becoming ACTIVE will modify the updated time
#Filter by the image's created time
@@ -240,7 +232,7 @@
@attr(type='negative')
def test_get_nonexistant_image(self):
- """Negative test: GET on non existant image should fail"""
+ # Negative test: GET on non existant image should fail
try:
resp, image = self.client.get_image(999)
except Exception:
diff --git a/tempest/tests/compute/images/test_list_images.py b/tempest/tests/compute/images/test_list_images.py
index 838c3a3..da92ca8 100644
--- a/tempest/tests/compute/images/test_list_images.py
+++ b/tempest/tests/compute/images/test_list_images.py
@@ -36,20 +36,20 @@
@attr(type='smoke')
def test_get_image(self):
- """Returns the correct details for a single image"""
+ # Returns the correct details for a single image
resp, image = self.client.get_image(self.image_ref)
self.assertEqual(self.image_ref, image['id'])
@attr(type='smoke')
def test_list_images(self):
- """The list of all images should contain the image"""
+ # The list of all images should contain the image
resp, images = self.client.list_images()
found = any([i for i in images if i['id'] == self.image_ref])
self.assertTrue(found)
@attr(type='smoke')
def test_list_images_with_detail(self):
- """Detailed list of all images should contain the expected images"""
+ # Detailed list of all images should contain the expected images
resp, images = self.client.list_images_with_detail()
found = any([i for i in images if i['id'] == self.image_ref])
self.assertTrue(found)
diff --git a/tempest/tests/compute/keypairs/test_keypairs.py b/tempest/tests/compute/keypairs/test_keypairs.py
index 447d965..7d95a9b 100644
--- a/tempest/tests/compute/keypairs/test_keypairs.py
+++ b/tempest/tests/compute/keypairs/test_keypairs.py
@@ -28,7 +28,7 @@
@attr(type='positive')
def test_keypairs_create_list_delete(self):
- """Keypairs created should be available in the response list"""
+ # Keypairs created should be available in the response list
#Create 3 keypairs
key_list = list()
for i in range(3):
@@ -62,7 +62,7 @@
@attr(type='positive')
def test_keypair_create_delete(self):
- """Keypair should be created, verified and deleted"""
+ # Keypair should be created, verified and deleted
k_name = rand_name('keypair-')
resp, keypair = self.client.create_keypair(k_name)
self.assertEqual(200, resp.status)
@@ -79,7 +79,7 @@
@attr(type='positive')
@unittest.skip("Skipped until the Bug #980688 is resolved")
def test_get_keypair_detail(self):
- """Keypair should be created, Got details by name and deleted"""
+ # Keypair should be created, Got details by name and deleted
k_name = rand_name('keypair-')
resp, keypair = self.client.create_keypair(k_name)
try:
@@ -102,7 +102,7 @@
@attr(type='positive')
def test_keypair_create_with_pub_key(self):
- """Keypair should be created with a given public key"""
+ # Keypair should be created with a given public key
k_name = rand_name('keypair-')
pub_key = ("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs"
"Ne3/1ILNCqFyfYWDeTKLD6jEXC2OQHLmietMWW+/vd"
@@ -126,7 +126,7 @@
@attr(type='negative')
def test_keypair_create_with_invalid_pub_key(self):
- """Keypair should not be created with a non RSA public key"""
+ # Keypair should not be created with a non RSA public key
k_name = rand_name('keypair-')
pub_key = "ssh-rsa JUNK nova@ubuntu"
try:
@@ -139,7 +139,7 @@
@attr(type='negative')
@unittest.skip("Skipped until the Bug #1086980 is resolved")
def test_keypair_delete_nonexistant_key(self):
- """Non-existant key deletion should throw a proper error"""
+ # Non-existant key deletion should throw a proper error
k_name = rand_name("keypair-non-existant-")
try:
resp, _ = self.client.delete_keypair(k_name)
@@ -150,7 +150,7 @@
@attr(type='negative')
def test_create_keypair_with_empty_public_key(self):
- """Keypair should not be created with an empty public key"""
+ # Keypair should not be created with an empty public key
k_name = rand_name("keypair-")
pub_key = ' '
try:
@@ -162,7 +162,7 @@
@attr(type='negative')
def test_create_keypair_when_public_key_bits_exceeds_maximum(self):
- """Keypair should not be created when public key bits are too long"""
+ # Keypair should not be created when public key bits are too long
k_name = rand_name("keypair-")
pub_key = 'ssh-rsa ' + 'A' * 2048 + ' openstack@ubuntu'
try:
@@ -174,7 +174,7 @@
@attr(type='negative')
def test_create_keypair_with_duplicate_name(self):
- """Keypairs with duplicate names should not be created"""
+ # Keypairs with duplicate names should not be created
k_name = rand_name('keypair-')
resp, _ = self.client.create_keypair(k_name)
self.assertEqual(200, resp.status)
@@ -191,7 +191,7 @@
@attr(type='negative')
def test_create_keypair_with_empty_name_string(self):
- """Keypairs with name being an empty string should not be created"""
+ # Keypairs with name being an empty string should not be created
try:
resp, _ = self.client.create_keypair('')
except exceptions.BadRequest:
@@ -201,7 +201,7 @@
@attr(type='negative')
def test_create_keypair_with_long_keynames(self):
- """Keypairs with name longer than 255 chars should not be created"""
+ # Keypairs with name longer than 255 chars should not be created
k_name = 'keypair-'.ljust(260, '0')
try:
resp, _ = self.client.create_keypair(k_name)
@@ -212,7 +212,7 @@
@attr(type='negative')
def test_create_keypair_invalid_name(self):
- """Keypairs with name being an invalid name should not be created"""
+ # Keypairs with name being an invalid name should not be created
k_name = 'key_/.\@:'
try:
resp, _ = self.client.create_keypair(k_name)
diff --git a/tempest/tests/compute/limits/test_absolute_limits.py b/tempest/tests/compute/limits/test_absolute_limits.py
index ede0dc2..89c5b25 100644
--- a/tempest/tests/compute/limits/test_absolute_limits.py
+++ b/tempest/tests/compute/limits/test_absolute_limits.py
@@ -28,9 +28,7 @@
@unittest.skip("Skipped until the Bug #1025294 is resolved")
def test_absLimits_get(self):
- """
- To check if all limits are present in the response
- """
+ # To check if all limits are present in the response
resp, absolute_limits = self.client.get_absolute_limits()
expected_elements = ['maxImageMeta', 'maxPersonality',
'maxPersonalitySize',
diff --git a/tempest/tests/compute/security_groups/test_security_group_rules.py b/tempest/tests/compute/security_groups/test_security_group_rules.py
index ab5af92..805adf4 100644
--- a/tempest/tests/compute/security_groups/test_security_group_rules.py
+++ b/tempest/tests/compute/security_groups/test_security_group_rules.py
@@ -30,10 +30,8 @@
@attr(type='positive')
def test_security_group_rules_create(self):
- """
- Positive test: Creation of Security Group rule
- should be successfull
- """
+ # Positive test: Creation of Security Group rule
+ # should be successfull
try:
#Creating a Security Group to add rules to it
s_name = rand_name('securitygroup-')
@@ -60,11 +58,10 @@
@attr(type='positive')
def test_security_group_rules_create_with_optional_arguments(self):
- """
- Positive test: Creation of Security Group rule
- with optional arguments
- should be successfull
- """
+ # Positive test: Creation of Security Group rule
+ # with optional arguments
+ # should be successfull
+
rule_id = None
secgroup1 = None
secgroup2 = None
@@ -108,10 +105,8 @@
@attr(type='positive')
def test_security_group_rules_create_delete(self):
- """
- Positive test: Deletion of Security Group rule
- should be successfull
- """
+ # Positive test: Deletion of Security Group rule
+ # should be successfull
try:
#Creating a Security Group to add rule to it
s_name = rand_name('securitygroup-')
@@ -137,10 +132,8 @@
@attr(type='negative')
def test_security_group_rules_create_with_invalid_id(self):
- """
- Negative test: Creation of Security Group rule should FAIL
- with invalid Parent group id
- """
+ # Negative test: Creation of Security Group rule should FAIL
+ # with invalid Parent group id
#Adding rules to the invalid Security Group id
parent_group_id = rand_name('999')
ip_protocol = 'tcp'
@@ -159,10 +152,8 @@
@attr(type='negative')
def test_security_group_rules_create_with_invalid_ip_protocol(self):
- """
- Negative test: Creation of Security Group rule should FAIL
- with invalid ip_protocol
- """
+ # Negative test: Creation of Security Group rule should FAIL
+ # with invalid ip_protocol
#Creating a Security Group to add rule to it
s_name = rand_name('securitygroup-')
s_description = rand_name('description-')
@@ -188,10 +179,8 @@
@attr(type='negative')
def test_security_group_rules_create_with_invalid_from_port(self):
- """
- Negative test: Creation of Security Group rule should FAIL
- with invalid from_port
- """
+ # Negative test: Creation of Security Group rule should FAIL
+ # with invalid from_port
#Creating a Security Group to add rule to it
s_name = rand_name('securitygroup-')
s_description = rand_name('description-')
@@ -217,10 +206,8 @@
@attr(type='negative')
def test_security_group_rules_create_with_invalid_to_port(self):
- """
- Negative test: Creation of Security Group rule should FAIL
- with invalid from_port
- """
+ # Negative test: Creation of Security Group rule should FAIL
+ # with invalid from_port
#Creating a Security Group to add rule to it
s_name = rand_name('securitygroup-')
s_description = rand_name('description-')
@@ -246,10 +233,8 @@
@attr(type='negative')
def test_security_group_rules_delete_with_invalid_id(self):
- """
- Negative test: Deletion of Security Group rule should be FAIL
- with invalid rule id
- """
+ # Negative test: Deletion of Security Group rule should be FAIL
+ # with invalid rule id
try:
self.client.delete_security_group_rule(rand_name('999'))
except exceptions.NotFound:
diff --git a/tempest/tests/compute/security_groups/test_security_groups.py b/tempest/tests/compute/security_groups/test_security_groups.py
index 1c0cc94..5c0bd82 100644
--- a/tempest/tests/compute/security_groups/test_security_groups.py
+++ b/tempest/tests/compute/security_groups/test_security_groups.py
@@ -30,7 +30,7 @@
@attr(type='positive')
def test_security_groups_create_list_delete(self):
- """Positive test:Should return the list of Security Groups"""
+ # Positive test:Should return the list of Security Groups
try:
#Create 3 Security Groups
security_group_list = list()
@@ -61,7 +61,7 @@
@attr(type='positive')
def test_security_group_create_delete(self):
- """Security Group should be created, verified and deleted"""
+ # Security Group should be created, verified and deleted
try:
s_name = rand_name('securitygroup-')
s_description = rand_name('description-')
@@ -83,7 +83,7 @@
@attr(type='positive')
def test_security_group_create_get_delete(self):
- """Security Group should be created, fetched and deleted"""
+ # Security Group should be created, fetched and deleted
try:
s_name = rand_name('securitygroup-')
s_description = rand_name('description-')
@@ -104,10 +104,8 @@
@attr(type='negative')
def test_security_group_get_nonexistant_group(self):
- """
- Negative test:Should not be able to GET the details
- of nonexistant Security Group
- """
+ # Negative test:Should not be able to GET the details
+ # of nonexistant Security Group
security_group_id = []
resp, body = self.client.list_security_groups()
for i in range(len(body)):
@@ -128,10 +126,8 @@
@attr(type='negative')
def test_security_group_create_with_invalid_group_name(self):
- """
- Negative test: Security Group should not be created with group name as
- an empty string/with white spaces/chars more than 255
- """
+ # Negative test: Security Group should not be created with group name
+ # as an empty string/with white spaces/chars more than 255
s_description = rand_name('description-')
#Create Security Group with empty string as group name
try:
@@ -161,10 +157,8 @@
@attr(type='negative')
def test_security_group_create_with_invalid_group_description(self):
- """
- Negative test:Security Group should not be created with description as
- an empty string/with white spaces/chars more than 255
- """
+ # Negative test:Security Group should not be created with description
+ # as an empty string/with white spaces/chars more than 255
s_name = rand_name('securitygroup-')
#Create Security Group with empty string as description
try:
@@ -194,10 +188,8 @@
@attr(type='negative')
def test_security_group_create_with_duplicate_name(self):
- """
- Negative test:Security Group with duplicate name should not
- be created
- """
+ # Negative test:Security Group with duplicate name should not
+ # be created
try:
s_name = rand_name('securitygroup-')
s_description = rand_name('description-')
@@ -220,9 +212,7 @@
@attr(type='negative')
def test_delete_nonexistant_security_group(self):
- """
- Negative test:Deletion of a nonexistant Security Group should Fail
- """
+ # Negative test:Deletion of a nonexistant Security Group should Fail
security_group_id = []
resp, body = self.client.list_security_groups()
for i in range(len(body)):
@@ -242,10 +232,8 @@
@attr(type='negative')
def test_delete_security_group_without_passing_id(self):
- """
- Negative test:Deletion of a Security Group with out passing ID
- should Fail
- """
+ # Negative test:Deletion of a Security Group with out passing ID
+ # should Fail
try:
resp, body = self.client.delete_security_group('')
except exceptions.NotFound:
@@ -255,10 +243,8 @@
'with out passing ID')
def test_server_security_groups(self):
- """
- Checks that security groups may be added and linked to a server
- and not deleted if the server is active.
- """
+ # Checks that security groups may be added and linked to a server
+ # and not deleted if the server is active.
# Create a couple security groups that we will use
# for the server resource this test creates
sg_name = rand_name('sg')
diff --git a/tempest/tests/compute/servers/test_console_output.py b/tempest/tests/compute/servers/test_console_output.py
index ce1047f..3ad29a1 100644
--- a/tempest/tests/compute/servers/test_console_output.py
+++ b/tempest/tests/compute/servers/test_console_output.py
@@ -43,10 +43,8 @@
@attr(type='positive')
def test_get_console_output(self):
- """
- Positive test:Should be able to GET the console output
- for a given server_id and number of lines
- """
+ # Positive test:Should be able to GET the console output
+ # for a given server_id and number of lines
def get_output():
resp, output = self.client.get_console_output(self.server_id, 10)
self.assertEqual(200, resp.status)
@@ -57,10 +55,8 @@
@attr(type='negative')
def test_get_console_output_invalid_server_id(self):
- """
- Negative test: Should not be able to get the console output
- for an invalid server_id
- """
+ # Negative test: Should not be able to get the console output
+ # for an invalid server_id
try:
resp, output = self.client.get_console_output('!@#$%^&*()', 10)
except exceptions.NotFound:
@@ -69,10 +65,8 @@
@attr(type='positive')
@unittest.skip('Until tempest bug 1014683 is fixed.')
def test_get_console_output_server_id_in_reboot_status(self):
- """
- Positive test:Should be able to GET the console output
- for a given server_id in reboot status
- """
+ # Positive test:Should be able to GET the console output
+ # for a given server_id in reboot status
try:
resp, output = self.servers_client.reboot(self.server_id, 'SOFT')
self.servers_client.wait_for_server_status(self.server_id,
diff --git a/tempest/tests/compute/servers/test_create_server.py b/tempest/tests/compute/servers/test_create_server.py
index 4fe4284..c5a54dc 100644
--- a/tempest/tests/compute/servers/test_create_server.py
+++ b/tempest/tests/compute/servers/test_create_server.py
@@ -43,7 +43,7 @@
cls.accessIPv6canon = '::babe:dc0c:1602'
cls.name = rand_name('server')
file_contents = 'This is a test file.'
- personality = [{'path': '/etc/test.txt',
+ personality = [{'path': '/test.txt',
'contents': base64.b64encode(file_contents)}]
cls.client = cls.servers_client
cli_resp = cls.client.create_server(cls.name,
@@ -65,14 +65,14 @@
@attr(type='smoke')
def test_create_server_response(self):
- """Check that the required fields are returned with values"""
+ # Check that the required fields are returned with values
self.assertEqual(202, self.resp.status)
self.assertTrue(self.server_initial['id'] is not None)
self.assertTrue(self.server_initial['adminPass'] is not None)
@attr(type='smoke')
def test_verify_server_details(self):
- """Verify the specified server attributes are set correctly"""
+ # Verify the specified server attributes are set correctly
self.assertEqual(self.accessIPv4, self.server['accessIPv4'])
self.assertIn(self.server['accessIPv6'],
[self.accessIPv6, self.accessIPv6canon])
@@ -83,7 +83,7 @@
@attr(type='smoke')
def test_list_servers(self):
- """The created server should be in the list of all servers"""
+ # The created server should be in the list of all servers
resp, body = self.client.list_servers()
servers = body['servers']
found = any([i for i in servers if i['id'] == self.server['id']])
@@ -91,7 +91,7 @@
@attr(type='smoke')
def test_list_servers_with_detail(self):
- """The created server should be in the detailed list of all servers"""
+ # The created server should be in the detailed list of all servers
resp, body = self.client.list_servers_with_detail()
servers = body['servers']
found = any([i for i in servers if i['id'] == self.server['id']])
@@ -100,17 +100,15 @@
@attr(type='positive')
@unittest.skipIf(not run_ssh, 'Instance validation tests are disabled.')
def test_can_log_into_created_server(self):
- """Check that the user can authenticate with the generated password"""
+ # Check that the user can authenticate with the generated password
linux_client = RemoteClient(self.server, self.ssh_user, self.password)
self.assertTrue(linux_client.can_authenticate())
@attr(type='positive')
@unittest.skipIf(not run_ssh, 'Instance validation tests are disabled.')
def test_verify_created_server_vcpus(self):
- """
- Verify that the number of vcpus reported by the instance matches
- the amount stated by the flavor
- """
+ # Verify that the number of vcpus reported by the instance matches
+ # the amount stated by the flavor
resp, flavor = self.flavors_client.get_flavor_details(self.flavor_ref)
linux_client = RemoteClient(self.server, self.ssh_user, self.password)
self.assertEqual(flavor['vcpus'], linux_client.get_number_of_vcpus())
@@ -118,7 +116,7 @@
@attr(type='positive')
@unittest.skipIf(not run_ssh, 'Instance validation tests are disabled.')
def test_host_name_is_same_as_server_name(self):
- """Verify the instance host name is the same as the server name"""
+ # Verify the instance host name is the same as the server name
linux_client = RemoteClient(self.server, self.ssh_user, self.password)
self.assertTrue(linux_client.hostname_equals_servername(self.name))
diff --git a/tempest/tests/compute/servers/test_disk_config.py b/tempest/tests/compute/servers/test_disk_config.py
index 7ff666f..490156b 100644
--- a/tempest/tests/compute/servers/test_disk_config.py
+++ b/tempest/tests/compute/servers/test_disk_config.py
@@ -37,7 +37,7 @@
@attr(type='positive')
def test_rebuild_server_with_manual_disk_config(self):
- """A server should be rebuilt using the manual disk config option"""
+ # A server should be rebuilt using the manual disk config option
name = rand_name('server')
resp, server = self.create_server_with_extras(name,
self.image_ref,
@@ -67,7 +67,7 @@
@attr(type='positive')
def test_rebuild_server_with_auto_disk_config(self):
- """A server should be rebuilt using the auto disk config option"""
+ # A server should be rebuilt using the auto disk config option
name = rand_name('server')
resp, server = self.create_server_with_extras(name,
self.image_ref,
@@ -98,7 +98,7 @@
@attr(type='positive')
@unittest.skipUnless(compute.RESIZE_AVAILABLE, 'Resize not available.')
def test_resize_server_from_manual_to_auto(self):
- """A server should be resized from manual to auto disk config"""
+ # A server should be resized from manual to auto disk config
name = rand_name('server')
resp, server = self.create_server_with_extras(name,
self.image_ref,
@@ -124,7 +124,7 @@
@attr(type='positive')
@unittest.skipUnless(compute.RESIZE_AVAILABLE, 'Resize not available.')
def test_resize_server_from_auto_to_manual(self):
- """A server should be resized from auto to manual disk config"""
+ # A server should be resized from auto to manual disk config
name = rand_name('server')
resp, server = self.create_server_with_extras(name,
self.image_ref,
diff --git a/tempest/tests/compute/servers/test_list_server_filters.py b/tempest/tests/compute/servers/test_list_server_filters.py
index 3aeb8e8..5eea24f 100644
--- a/tempest/tests/compute/servers/test_list_server_filters.py
+++ b/tempest/tests/compute/servers/test_list_server_filters.py
@@ -94,7 +94,7 @@
@utils.skip_unless_attr('multiple_images', 'Only one image found')
@attr(type='positive')
def test_list_servers_filter_by_image(self):
- """Filter the list of servers by image"""
+ # Filter the list of servers by image
params = {'image': self.image_ref}
resp, body = self.client.list_servers(params)
servers = body['servers']
@@ -105,7 +105,7 @@
@attr(type='positive')
def test_list_servers_filter_by_flavor(self):
- """Filter the list of servers by flavor"""
+ # Filter the list of servers by flavor
params = {'flavor': self.flavor_ref_alt}
resp, body = self.client.list_servers(params)
servers = body['servers']
@@ -116,7 +116,7 @@
@attr(type='positive')
def test_list_servers_filter_by_server_name(self):
- """Filter the list of servers by server name"""
+ # Filter the list of servers by server name
params = {'name': self.s1_name}
resp, body = self.client.list_servers(params)
servers = body['servers']
@@ -127,7 +127,7 @@
@attr(type='positive')
def test_list_servers_filter_by_server_status(self):
- """Filter the list of servers by server status"""
+ # Filter the list of servers by server status
params = {'status': 'active'}
resp, body = self.client.list_servers(params)
servers = body['servers']
@@ -138,7 +138,7 @@
@attr(type='positive')
def test_list_servers_limit_results(self):
- """Verify only the expected number of servers are returned"""
+ # Verify only the expected number of servers are returned
params = {'limit': 1}
resp, servers = self.client.list_servers_with_detail(params)
self.assertEqual(1, len(servers['servers']))
@@ -146,7 +146,7 @@
@utils.skip_unless_attr('multiple_images', 'Only one image found')
@attr(type='positive')
def test_list_servers_detailed_filter_by_image(self):
- """Filter the detailed list of servers by image"""
+ # Filter the detailed list of servers by image
params = {'image': self.image_ref}
resp, body = self.client.list_servers_with_detail(params)
servers = body['servers']
@@ -157,7 +157,7 @@
@attr(type='positive')
def test_list_servers_detailed_filter_by_flavor(self):
- """Filter the detailed list of servers by flavor"""
+ # Filter the detailed list of servers by flavor
params = {'flavor': self.flavor_ref_alt}
resp, body = self.client.list_servers_with_detail(params)
servers = body['servers']
@@ -168,7 +168,7 @@
@attr(type='positive')
def test_list_servers_detailed_filter_by_server_name(self):
- """Filter the detailed list of servers by server name"""
+ # Filter the detailed list of servers by server name
params = {'name': self.s1_name}
resp, body = self.client.list_servers_with_detail(params)
servers = body['servers']
@@ -179,7 +179,7 @@
@attr(type='positive')
def test_list_servers_detailed_filter_by_server_status(self):
- """Filter the detailed list of servers by server status"""
+ # Filter the detailed list of servers by server status
params = {'status': 'active'}
resp, body = self.client.list_servers_with_detail(params)
servers = body['servers']
@@ -190,7 +190,7 @@
@attr(type='positive')
def test_list_servers_detailed_limit_results(self):
- """Verify only the expected number of detailed results are returned"""
+ # Verify only the expected number of detailed results are returned
params = {'limit': 1}
resp, servers = self.client.list_servers_with_detail(params)
self.assertEqual(1, len(servers['servers']))
diff --git a/tempest/tests/compute/servers/test_list_servers_negative.py b/tempest/tests/compute/servers/test_list_servers_negative.py
index dc6e339..e98d8f0 100644
--- a/tempest/tests/compute/servers/test_list_servers_negative.py
+++ b/tempest/tests/compute/servers/test_list_servers_negative.py
@@ -97,7 +97,7 @@
cls.deleted_fixtures.append(srv)
def test_list_servers_with_a_deleted_server(self):
- """Verify deleted servers do not show by default in list servers"""
+ # Verify deleted servers do not show by default in list servers
# List servers and verify server not returned
resp, body = self.client.list_servers()
servers = body['servers']
@@ -108,7 +108,7 @@
self.assertEqual([], actual)
def test_list_servers_by_non_existing_image(self):
- """Listing servers for a non existing image returns empty list"""
+ # Listing servers for a non existing image returns empty list
non_existing_image = '1234abcd-zzz0-aaa9-ppp3-0987654abcde'
resp, body = self.client.list_servers(dict(image=non_existing_image))
servers = body['servers']
@@ -116,7 +116,7 @@
self.assertEqual([], servers)
def test_list_servers_by_non_existing_flavor(self):
- """Listing servers by non existing flavor returns empty list"""
+ # Listing servers by non existing flavor returns empty list
non_existing_flavor = 1234
resp, body = self.client.list_servers(dict(flavor=non_existing_flavor))
servers = body['servers']
@@ -124,7 +124,7 @@
self.assertEqual([], servers)
def test_list_servers_by_non_existing_server_name(self):
- """Listing servers for a non existent server name returns empty list"""
+ # Listing servers for a non existent server name returns empty list
non_existing_name = 'junk_server_1234'
resp, body = self.client.list_servers(dict(name=non_existing_name))
servers = body['servers']
@@ -133,7 +133,7 @@
@unittest.skip("Skip until bug 1061712 is resolved")
def test_list_servers_status_non_existing(self):
- """Return an empty list when invalid status is specified"""
+ # Return an empty list when invalid status is specified
non_existing_status = 'BALONEY'
resp, body = self.client.list_servers(dict(status=non_existing_status))
servers = body['servers']
@@ -141,29 +141,29 @@
self.assertEqual([], servers)
def test_list_servers_by_limits(self):
- """List servers by specifying limits"""
+ # List servers by specifying limits
resp, body = self.client.list_servers({'limit': 1})
self.assertEqual('200', resp['status'])
self.assertEqual(1, len(body['servers']))
def test_list_servers_by_limits_greater_than_actual_count(self):
- """List servers by specifying a greater value for limit"""
+ # List servers by specifying a greater value for limit
resp, body = self.client.list_servers({'limit': 100})
self.assertEqual('200', resp['status'])
self.assertEqual(len(self.existing_fixtures), len(body['servers']))
def test_list_servers_by_limits_pass_string(self):
- """Return an error if a string value is passed for limit"""
+ # Return an error if a string value is passed for limit
self.assertRaises(exceptions.BadRequest, self.client.list_servers,
{'limit': 'testing'})
def test_list_servers_by_limits_pass_negative_value(self):
- """Return an error if a negative value for limit is passed"""
+ # Return an error if a negative value for limit is passed
self.assertRaises(exceptions.BadRequest, self.client.list_servers,
{'limit': -1})
def test_list_servers_by_changes_since(self):
- """Servers are listed by specifying changes-since date"""
+ # Servers are listed by specifying changes-since date
changes_since = {'changes-since': '2011-01-01T12:34:00Z'}
resp, body = self.client.list_servers(changes_since)
self.assertEqual('200', resp['status'])
@@ -173,19 +173,19 @@
self.assertEqual(num_expected, len(body['servers']))
def test_list_servers_by_changes_since_invalid_date(self):
- """Return an error when invalid date format is passed"""
+ # Return an error when invalid date format is passed
self.assertRaises(exceptions.BadRequest, self.client.list_servers,
{'changes-since': '2011/01/01'})
def test_list_servers_by_changes_since_future_date(self):
- """Return an empty list when a date in the future is passed"""
+ # Return an empty list when a date in the future is passed
changes_since = {'changes-since': '2051-01-01T12:34:00Z'}
resp, body = self.client.list_servers(changes_since)
self.assertEqual('200', resp['status'])
self.assertEqual(0, len(body['servers']))
def test_list_servers_detail_server_is_deleted(self):
- """Server details are not listed for a deleted server"""
+ # Server details are not listed for a deleted server
deleted_ids = [s['id'] for s in self.deleted_fixtures]
resp, body = self.client.list_servers_with_detail()
servers = body['servers']
diff --git a/tempest/tests/compute/servers/test_server_actions.py b/tempest/tests/compute/servers/test_server_actions.py
index df971e9..f4e62b1 100644
--- a/tempest/tests/compute/servers/test_server_actions.py
+++ b/tempest/tests/compute/servers/test_server_actions.py
@@ -50,7 +50,7 @@
@unittest.skipUnless(compute.CHANGE_PASSWORD_AVAILABLE,
'Change password not available.')
def test_change_server_password(self):
- """The server's password should be set to the provided password"""
+ # The server's password should be set to the provided password
new_password = 'Newpass1234'
resp, body = self.client.change_password(self.server_id, new_password)
self.assertEqual(202, resp.status)
@@ -64,7 +64,7 @@
@attr(type='smoke')
def test_reboot_server_hard(self):
- """ The server should be power cycled """
+ # The server should be power cycled
if self.run_ssh:
# Get the time the server was last rebooted,
# waiting for one minute as who doesn't have seconds precision
@@ -86,7 +86,7 @@
@attr(type='smoke')
@unittest.skip('Until bug 1014647 is dealt with.')
def test_reboot_server_soft(self):
- """The server should be signaled to reboot gracefully"""
+ # The server should be signaled to reboot gracefully
if self.run_ssh:
# Get the time the server was last rebooted,
# waiting for one minute as who doesn't have seconds precision
@@ -107,7 +107,7 @@
@attr(type='smoke')
def test_rebuild_server(self):
- """ The server should be rebuilt using the provided image and data """
+ # The server should be rebuilt using the provided image and data
meta = {'rebuild': 'server'}
new_name = rand_name('server')
file_contents = 'Test server rebuild.'
@@ -141,10 +141,8 @@
@attr(type='smoke')
@unittest.skipIf(not resize_available, 'Resize not available.')
def test_resize_server_confirm(self):
- """
- The server's RAM and disk space should be modified to that of
- the provided flavor
- """
+ # The server's RAM and disk space should be modified to that of
+ # the provided flavor
resp, server = self.client.resize(self.server_id, self.flavor_ref_alt)
self.assertEqual(202, resp.status)
@@ -159,10 +157,8 @@
@attr(type='positive')
@unittest.skipIf(not resize_available, 'Resize not available.')
def test_resize_server_revert(self):
- """
- The server's RAM and disk space should return to its original
- values after a resize is reverted
- """
+ # The server's RAM and disk space should return to its original
+ # values after a resize is reverted
resp, server = self.client.resize(self.server_id, self.flavor_ref_alt)
self.assertEqual(202, resp.status)
@@ -186,18 +182,14 @@
@attr(type='negative')
def test_reboot_nonexistent_server_soft(self):
- """
- Negative Test: The server reboot on non existent server should return
- an error
- """
+ # Negative Test: The server reboot on non existent server should return
+ # an error
self.assertRaises(exceptions.NotFound, self.client.reboot, 999, 'SOFT')
@attr(type='negative')
def test_rebuild_nonexistent_server(self):
- """
- Negative test: The server rebuild for a non existing server should not
- be allowed
- """
+ # Negative test: The server rebuild for a non existing server
+ # should not be allowed
meta = {'rebuild': 'server'}
new_name = rand_name('server')
file_contents = 'Test server rebuild.'
diff --git a/tempest/tests/compute/servers/test_server_addresses.py b/tempest/tests/compute/servers/test_server_addresses.py
index 745a9d8..6e819a2 100644
--- a/tempest/tests/compute/servers/test_server_addresses.py
+++ b/tempest/tests/compute/servers/test_server_addresses.py
@@ -42,7 +42,7 @@
@attr(type='negative', category='server-addresses')
def test_list_server_addresses_invalid_server_id(self):
- """List addresses request should fail if server id not in system"""
+ # List addresses request should fail if server id not in system
try:
self.client.list_addresses('999')
@@ -54,7 +54,7 @@
@attr(type='negative', category='server-addresses')
def test_list_server_addresses_by_network_neg(self):
- """List addresses by network should fail if network name not valid"""
+ # List addresses by network should fail if network name not valid
try:
self.client.list_addresses_by_network(self.server['id'], 'invalid')
@@ -66,8 +66,8 @@
@attr(type='smoke', category='server-addresses')
def test_list_server_addresses(self):
- """All public and private addresses for
- a server should be returned"""
+ # All public and private addresses for
+ # a server should be returned
resp, addresses = self.client.list_addresses(self.server['id'])
self.assertEqual('200', resp['status'])
@@ -83,8 +83,8 @@
@attr(type='smoke', category='server-addresses')
def test_list_server_addresses_by_network(self):
- """Providing a network type should filter
- the addresses return by that type"""
+ # Providing a network type should filter
+ # the addresses return by that type
resp, addresses = self.client.list_addresses(self.server['id'])
diff --git a/tempest/tests/compute/servers/test_server_metadata.py b/tempest/tests/compute/servers/test_server_metadata.py
index 0198e4e..6c44c3c 100644
--- a/tempest/tests/compute/servers/test_server_metadata.py
+++ b/tempest/tests/compute/servers/test_server_metadata.py
@@ -49,7 +49,7 @@
self.assertEqual(resp.status, 200)
def test_list_server_metadata(self):
- """All metadata key/value pairs for a server should be returned"""
+ # All metadata key/value pairs for a server should be returned
resp, resp_metadata = self.client.list_server_metadata(self.server_id)
#Verify the expected metadata items are in the list
@@ -58,7 +58,7 @@
self.assertEqual(expected, resp_metadata)
def test_set_server_metadata(self):
- """The server's metadata should be replaced with the provided values"""
+ # The server's metadata should be replaced with the provided values
#Create a new set of metadata for the server
req_metadata = {'meta2': 'data2', 'meta3': 'data3'}
resp, metadata = self.client.set_server_metadata(self.server_id,
@@ -71,10 +71,10 @@
self.assertEqual(resp_metadata, req_metadata)
def test_server_create_metadata_key_too_long(self):
- """
- Attempt to start a server with a meta-data key that is > 255 characters
- Try a few values
- """
+ # Attempt to start a server with a meta-data key that is > 255
+ # characters
+
+ # Try a few values
for sz in [256, 257, 511, 1023]:
key = "k" * sz
meta = {key: 'data1'}
@@ -87,10 +87,8 @@
# no teardown - all creates should fail
def test_update_server_metadata(self):
- """
- The server's metadata values should be updated to the
- provided values
- """
+ # The server's metadata values should be updated to the
+ # provided values
meta = {'key1': 'alt1', 'key3': 'value3'}
resp, metadata = self.client.update_server_metadata(self.server_id,
meta)
@@ -102,13 +100,13 @@
self.assertEqual(expected, resp_metadata)
def test_get_server_metadata_item(self):
- """ The value for a specic metadata key should be returned """
+ # The value for a specic metadata key should be returned
resp, meta = self.client.get_server_metadata_item(self.server_id,
'key2')
self.assertTrue('value2', meta['key2'])
def test_set_server_metadata_item(self):
- """The item's value should be updated to the provided value"""
+ # The item's value should be updated to the provided value
#Update the metadata value
meta = {'nova': 'alt'}
resp, body = self.client.set_server_metadata_item(self.server_id,
@@ -121,7 +119,7 @@
self.assertEqual(expected, resp_metadata)
def test_delete_server_metadata_item(self):
- """The metadata value/key pair should be deleted from the server"""
+ # The metadata value/key pair should be deleted from the server
resp, meta = self.client.delete_server_metadata_item(self.server_id,
'key1')
self.assertEqual(204, resp.status)
@@ -133,7 +131,7 @@
@attr(type='negative')
def test_get_nonexistant_server_metadata_item(self):
- """Negative test: GET on nonexistant server should not succeed"""
+ # Negative test: GET on nonexistant server should not succeed
try:
resp, meta = self.client.get_server_metadata_item(999, 'test2')
except Exception:
@@ -143,9 +141,8 @@
@attr(type='negative')
def test_list_nonexistant_server_metadata(self):
- """
- Negative test:List metadata on a non existant server should not succeed
- """
+ # Negative test:List metadata on a non existant server should
+ # not succeed
try:
resp, metadata = self.client.list_server_metadata(999)
except Exception:
@@ -156,9 +153,8 @@
@attr(type='negative')
def test_set_nonexistant_server_metadata(self):
- """
- Negative test: Set metadata on a non existant server should not succeed
- """
+ # Negative test: Set metadata on a non existant server should not
+ # succeed
meta = {'meta1': 'data1'}
try:
resp, metadata = self.client.set_server_metadata(999, meta)
@@ -170,9 +166,7 @@
@attr(type='negative')
def test_update_nonexistant_server_metadata(self):
- """
- Negative test: An update should not happen for a nonexistant image
- """
+ # Negative test: An update should not happen for a nonexistant image
meta = {'key1': 'value1', 'key2': 'value2'}
try:
resp, metadata = self.client.update_server_metadata(999, meta)
@@ -183,10 +177,8 @@
@attr(type='negative')
def test_delete_nonexistant_server_metadata_item(self):
- """
- Negative test: Should not be able to delete metadata item from a
- nonexistant server
- """
+ # Negative test: Should not be able to delete metadata item from a
+ # nonexistant server
meta = {'d': 'delvalue'}
#Delete the metadata item
diff --git a/tempest/tests/compute/servers/test_server_personality.py b/tempest/tests/compute/servers/test_server_personality.py
index 320bac4..6ea0959 100644
--- a/tempest/tests/compute/servers/test_server_personality.py
+++ b/tempest/tests/compute/servers/test_server_personality.py
@@ -27,10 +27,8 @@
class ServerPersonalityTestBase(object):
def test_personality_files_exceed_limit(self):
- """
- Server creation should fail if greater than the maximum allowed
- number of files are injected into the server.
- """
+ # Server creation should fail if greater than the maximum allowed
+ # number of files are injected into the server.
name = rand_name('server')
file_contents = 'This is a test file.'
personality = []
@@ -51,10 +49,8 @@
@attr(type='positive')
def test_can_create_server_with_max_number_personality_files(self):
- """
- Server should be created successfully if maximum allowed number of
- files is injected into the server during creation.
- """
+ # Server should be created successfully if maximum allowed number of
+ # files is injected into the server during creation.
try:
name = rand_name('server')
file_contents = 'This is a test file.'
diff --git a/tempest/tests/compute/servers/test_servers.py b/tempest/tests/compute/servers/test_servers.py
index fcf9975..3566ef4 100644
--- a/tempest/tests/compute/servers/test_servers.py
+++ b/tempest/tests/compute/servers/test_servers.py
@@ -25,10 +25,8 @@
@attr(type='positive')
def test_create_server_with_admin_password(self):
- """
- If an admin password is provided on server creation, the server's root
- password should be set to that password.
- """
+ # If an admin password is provided on server creation, the server's
+ # root password should be set to that password.
try:
server = None
@@ -47,7 +45,7 @@
self.client.delete_server(server['id'])
def test_create_with_existing_server_name(self):
- """Creating a server with a name that already exists is allowed"""
+ # Creating a server with a name that already exists is allowed
try:
id1 = None
@@ -76,7 +74,7 @@
@attr(type='positive')
def test_create_specify_keypair(self):
- """Specify a keypair while creating a server"""
+ # Specify a keypair while creating a server
try:
server = None
@@ -98,7 +96,7 @@
@attr(type='positive')
def test_update_server_name(self):
- """The server name should be changed to the the provided value"""
+ # The server name should be changed to the the provided value
try:
server = None
name = rand_name('server')
@@ -123,9 +121,7 @@
@attr(type='positive')
def test_update_access_server_address(self):
- """
- The server's access addresses should reflect the provided values
- """
+ # The server's access addresses should reflect the provided values
try:
server = None
name = rand_name('server')
@@ -151,7 +147,7 @@
self.client.delete_server(server['id'])
def test_delete_server_while_in_building_state(self):
- """Delete a server while it's VM state is Building"""
+ # Delete a server while it's VM state is Building
name = rand_name('server')
resp, server = self.create_server_with_extras(name, self.image_ref,
self.flavor_ref)
diff --git a/tempest/tests/compute/servers/test_servers_negative.py b/tempest/tests/compute/servers/test_servers_negative.py
index fd067cd..970f6bc 100644
--- a/tempest/tests/compute/servers/test_servers_negative.py
+++ b/tempest/tests/compute/servers/test_servers_negative.py
@@ -40,7 +40,7 @@
@attr(type='negative')
def test_server_name_blank(self):
- """Create a server with name parameter empty"""
+ # Create a server with name parameter empty
try:
resp, server = self.create_server_with_extras('',
self.image_ref,
@@ -52,7 +52,7 @@
@attr(type='negative')
def test_personality_file_contents_not_encoded(self):
- """Use an unencoded file when creating a server with personality"""
+ # Use an unencoded file when creating a server with personality
file_contents = 'This is a test file.'
person = [{'path': '/etc/testfile.txt',
'contents': file_contents}]
@@ -69,7 +69,7 @@
@attr(type='negative')
def test_create_with_invalid_image(self):
- """Create a server with an unknown image"""
+ # Create a server with an unknown image
try:
resp, server = self.create_server_with_extras('fail', -1,
self.flavor_ref)
@@ -80,7 +80,7 @@
@attr(type='negative')
def test_create_with_invalid_flavor(self):
- """Create a server with an unknown flavor"""
+ # Create a server with an unknown flavor
try:
self.create_server_with_extras('fail', self.image_ref, -1)
except exceptions.BadRequest:
@@ -90,7 +90,7 @@
@attr(type='negative')
def test_invalid_access_ip_v4_address(self):
- """An access IPv4 address must match a valid address pattern"""
+ # An access IPv4 address must match a valid address pattern
IPv4 = '1.1.1.1.1.1'
name = rand_name('server')
try:
@@ -105,7 +105,7 @@
@attr(type='negative')
def test_invalid_ip_v6_address(self):
- """An access IPv6 address must match a valid address pattern"""
+ # An access IPv6 address must match a valid address pattern
IPv6 = 'notvalid'
name = rand_name('server')
try:
@@ -120,7 +120,7 @@
@attr(type='negative')
def test_reboot_deleted_server(self):
- """Reboot a deleted server"""
+ # Reboot a deleted server
self.name = rand_name('server')
resp, create_server = self.create_server_with_extras(self.name,
self.image_ref,
@@ -137,7 +137,7 @@
@attr(type='negative')
def test_rebuild_deleted_server(self):
- """Rebuild a deleted server"""
+ # Rebuild a deleted server
self.name = rand_name('server')
resp, create_server = self.create_server_with_extras(self.name,
self.image_ref,
@@ -155,7 +155,7 @@
@attr(type='negative')
def test_create_numeric_server_name(self):
- """Create a server with a numeric name"""
+ # Create a server with a numeric name
server_name = 12345
self.assertRaises(exceptions.BadRequest,
@@ -164,7 +164,7 @@
@attr(type='negative')
def test_create_server_name_length_exceeds_256(self):
- """Create a server with name length exceeding 256 characters"""
+ # Create a server with name length exceeding 256 characters
server_name = 'a' * 256
self.assertRaises(exceptions.BadRequest,
@@ -173,7 +173,7 @@
@attr(type='negative')
def test_create_with_invalid_network_uuid(self):
- """Pass invalid network uuid while creating a server"""
+ # Pass invalid network uuid while creating a server
server_name = rand_name('server')
networks = [{'fixed_ip': '10.0.1.1', 'uuid':'a-b-c-d-e-f-g-h-i-j'}]
@@ -185,7 +185,7 @@
@attr(type='negative')
def test_create_with_non_existant_keypair(self):
- """Pass a non existant keypair while creating a server"""
+ # Pass a non existant keypair while creating a server
key_name = rand_name('key')
server_name = rand_name('server')
@@ -197,7 +197,7 @@
@unittest.skip("Until Bug 1004007 is fixed")
@attr(type='negative')
def test_create_server_metadata_exceeds_length_limit(self):
- """Pass really long metadata while creating a server"""
+ # Pass really long metadata while creating a server
server_name = rand_name('server')
metadata = {'a': 'b' * 260}
@@ -208,7 +208,7 @@
@attr(type='negative')
def test_update_name_of_non_existent_server(self):
- """Update name of a non-existent server"""
+ # Update name of a non-existent server
server_name = rand_name('server')
new_name = rand_name('server') + '_updated'
@@ -218,7 +218,7 @@
@attr(type='negative')
def test_update_server_set_empty_name(self):
- """Update name of the server to an empty string"""
+ # Update name of the server to an empty string
server_name = rand_name('server')
new_name = ''
@@ -228,7 +228,7 @@
@attr(type='negative')
def test_update_server_of_another_tenant(self):
- """Update name of a server that belongs to another tenant"""
+ # Update name of a server that belongs to another tenant
server = self.create_server()
new_name = server['id'] + '_new'
@@ -238,7 +238,7 @@
@attr(type='negative')
def test_update_server_name_length_exceeds_256(self):
- """Update name of server exceed the name length limit"""
+ # Update name of server exceed the name length limit
server = self.create_server()
new_name = 'a' * 256
@@ -249,14 +249,14 @@
@attr(type='negative')
def test_delete_non_existent_server(self):
- """Delete a non existent server"""
+ # Delete a non existent server
self.assertRaises(exceptions.NotFound, self.client.delete_server,
'999erra43')
@attr(type='negative')
def test_delete_a_server_of_another_tenant(self):
- """Delete a server that belongs to another tenant"""
+ # Delete a server that belongs to another tenant
try:
server = self.create_server()
self.assertRaises(exceptions.NotFound,
@@ -267,13 +267,13 @@
@attr(type='negative')
def test_delete_server_pass_negative_id(self):
- """Pass an invalid string parameter to delete server"""
+ # Pass an invalid string parameter to delete server
self.assertRaises(exceptions.NotFound, self.client.delete_server, -1)
@attr(type='negative')
def test_delete_server_pass_id_exceeding_length_limit(self):
- """Pass a server ID that exceeds length limit to delete server"""
+ # Pass a server ID that exceeds length limit to delete server
self.assertRaises(exceptions.NotFound, self.client.delete_server,
sys.maxint + 1)
diff --git a/tempest/tests/compute/servers/test_servers_whitebox.py b/tempest/tests/compute/servers/test_servers_whitebox.py
index 16254e7..3ff4df6 100644
--- a/tempest/tests/compute/servers/test_servers_whitebox.py
+++ b/tempest/tests/compute/servers/test_servers_whitebox.py
@@ -53,7 +53,7 @@
continue
def test_create_server_vcpu_quota_full(self):
- """Disallow server creation when tenant's vcpu quota is full"""
+ # Disallow server creation when tenant's vcpu quota is full
quotas = self.meta.tables['quotas']
stmt = quotas.select().where(
quotas.c.project_id == self.tenant_id).where(
@@ -85,7 +85,7 @@
self.connection.execute(stmt, autocommit=True)
def test_create_server_memory_quota_full(self):
- """Disallow server creation when tenant's memory quota is full"""
+ # Disallow server creation when tenant's memory quota is full
quotas = self.meta.tables['quotas']
stmt = quotas.select().where(
quotas.c.project_id == self.tenant_id).where(
@@ -117,7 +117,7 @@
self.connection.execute(stmt, autocommit=True)
def update_state(self, server_id, vm_state, task_state, deleted=False):
- """Update states of an instance in database for validation"""
+ """Update states of an instance in database for validation."""
if not task_state:
task_state = 'NULL'
@@ -171,83 +171,81 @@
self.update_state(self.shared_server['id'], 'active', None)
def test_delete_server_when_vm_eq_building_task_eq_networking(self):
- """Delete server when instance states are building,networking"""
+ # Delete server when instance states are building,networking
self._test_delete_server_base('building', 'networking')
def test_delete_server_when_vm_eq_building_task_eq_bdm(self):
- """
- Delete server when instance states are building,block device mapping
- """
+ # Delete server when instance states are building,block device mapping
self._test_delete_server_base('building', 'block_device_mapping')
def test_delete_server_when_vm_eq_building_task_eq_spawning(self):
- """Delete server when instance states are building,spawning"""
+ # Delete server when instance states are building,spawning
self._test_delete_server_base('building', 'spawning')
def test_delete_server_when_vm_eq_active_task_eq_image_backup(self):
- """Delete server when instance states are active,image_backup"""
+ # Delete server when instance states are active,image_backup
self._test_delete_server_base('active', 'image_backup')
def test_delete_server_when_vm_eq_active_task_eq_rebuilding(self):
- """Delete server when instance states are active,rebuilding"""
+ # Delete server when instance states are active,rebuilding
self._test_delete_server_base('active', 'rebuilding')
def test_delete_server_when_vm_eq_error_task_eq_spawning(self):
- """Delete server when instance states are error,spawning"""
+ # Delete server when instance states are error,spawning
self._test_delete_server_base('error', 'spawning')
def test_delete_server_when_vm_eq_resized_task_eq_resize_prep(self):
- """Delete server when instance states are resized,resize_prep"""
+ # Delete server when instance states are resized,resize_prep
self._test_delete_server_403_base('resized', 'resize_prep')
def test_delete_server_when_vm_eq_resized_task_eq_resize_migrating(self):
- """Delete server when instance states are resized,resize_migrating"""
+ # Delete server when instance states are resized,resize_migrating
self._test_delete_server_403_base('resized', 'resize_migrating')
def test_delete_server_when_vm_eq_resized_task_eq_resize_migrated(self):
- """Delete server when instance states are resized,resize_migrated"""
+ # Delete server when instance states are resized,resize_migrated
self._test_delete_server_403_base('resized', 'resize_migrated')
def test_delete_server_when_vm_eq_resized_task_eq_resize_finish(self):
- """Delete server when instance states are resized,resize_finish"""
+ # Delete server when instance states are resized,resize_finish
self._test_delete_server_403_base('resized', 'resize_finish')
def test_delete_server_when_vm_eq_resized_task_eq_resize_reverting(self):
- """Delete server when instance states are resized,resize_reverting"""
+ # Delete server when instance states are resized,resize_reverting
self._test_delete_server_403_base('resized', 'resize_reverting')
def test_delete_server_when_vm_eq_resized_task_eq_resize_confirming(self):
- """Delete server when instance states are resized,resize_confirming"""
+ # Delete server when instance states are resized,resize_confirming
self._test_delete_server_403_base('resized', 'resize_confirming')
def test_delete_server_when_vm_eq_active_task_eq_resize_verify(self):
- """Delete server when instance states are active,resize_verify"""
+ # Delete server when instance states are active,resize_verify
self._test_delete_server_base('active', 'resize_verify')
def test_delete_server_when_vm_eq_active_task_eq_rebooting(self):
- """Delete server when instance states are active,rebooting"""
+ # Delete server when instance states are active,rebooting
self._test_delete_server_base('active', 'rebooting')
def test_delete_server_when_vm_eq_building_task_eq_deleting(self):
- """Delete server when instance states are building,deleting"""
+ # Delete server when instance states are building,deleting
self._test_delete_server_base('building', 'deleting')
def test_delete_server_when_vm_eq_active_task_eq_deleting(self):
- """Delete server when instance states are active,deleting"""
+ # Delete server when instance states are active,deleting
self._test_delete_server_base('active', 'deleting')
def test_delete_server_when_vm_eq_error_task_eq_none(self):
- """Delete server when instance states are error,None"""
+ # Delete server when instance states are error,None
self._test_delete_server_base('error', None)
def test_delete_server_when_vm_eq_resized_task_eq_none(self):
- """Delete server when instance states are resized,None"""
+ # Delete server when instance states are resized,None
self._test_delete_server_403_base('resized', None)
def test_delete_server_when_vm_eq_error_task_eq_resize_prep(self):
- """Delete server when instance states are error,resize_prep"""
+ # Delete server when instance states are error,resize_prep
self._test_delete_server_base('error', 'resize_prep')
def test_delete_server_when_vm_eq_error_task_eq_error(self):
- """Delete server when instance states are error,error"""
+ # Delete server when instance states are error,error
self._test_delete_server_base('error', 'error')
diff --git a/tempest/tests/compute/test_authorization.py b/tempest/tests/compute/test_authorization.py
index 64f6464..78661d1 100644
--- a/tempest/tests/compute/test_authorization.py
+++ b/tempest/tests/compute/test_authorization.py
@@ -105,41 +105,37 @@
@raises(exceptions.NotFound)
@attr(type='negative')
def test_get_server_for_alt_account_fails(self):
- """A GET request for a server on another user's account should fail"""
+ # A GET request for a server on another user's account should fail
self.alt_client.get_server(self.server['id'])
@raises(exceptions.NotFound)
@attr(type='negative')
def test_delete_server_for_alt_account_fails(self):
- """A DELETE request for another user's server should fail"""
+ # A DELETE request for another user's server should fail
self.alt_client.delete_server(self.server['id'])
@raises(exceptions.NotFound)
@attr(type='negative')
def test_update_server_for_alt_account_fails(self):
- """An update server request for another user's server should fail"""
+ # An update server request for another user's server should fail
self.alt_client.update_server(self.server['id'], name='test')
@raises(exceptions.NotFound)
@attr(type='negative')
def test_list_server_addresses_for_alt_account_fails(self):
- """A list addresses request for another user's server should fail"""
+ # A list addresses request for another user's server should fail
self.alt_client.list_addresses(self.server['id'])
@raises(exceptions.NotFound)
@attr(type='negative')
def test_list_server_addresses_by_network_for_alt_account_fails(self):
- """
- A list address/network request for another user's server should fail
- """
+ # A list address/network request for another user's server should fail
server_id = self.server['id']
self.alt_client.list_addresses_by_network(server_id, 'public')
def test_list_servers_with_alternate_tenant(self):
- """
- A list on servers from one tenant should not
- show on alternate tenant
- """
+ # A list on servers from one tenant should not
+ # show on alternate tenant
#Listing servers from alternate tenant
alt_server_ids = []
resp, body = self.alt_client.list_servers()
@@ -149,47 +145,45 @@
@raises(exceptions.NotFound)
@attr(type='negative')
def test_change_password_for_alt_account_fails(self):
- """A change password request for another user's server should fail"""
+ # A change password request for another user's server should fail
self.alt_client.change_password(self.server['id'], 'newpass')
@raises(exceptions.NotFound)
@attr(type='negative')
def test_reboot_server_for_alt_account_fails(self):
- """A reboot request for another user's server should fail"""
+ # A reboot request for another user's server should fail
self.alt_client.reboot(self.server['id'], 'HARD')
@raises(exceptions.NotFound)
@attr(type='negative')
def test_rebuild_server_for_alt_account_fails(self):
- """A rebuild request for another user's server should fail"""
+ # A rebuild request for another user's server should fail
self.alt_client.rebuild(self.server['id'], self.image_ref_alt)
@raises(exceptions.NotFound)
@attr(type='negative')
def test_resize_server_for_alt_account_fails(self):
- """A resize request for another user's server should fail"""
+ # A resize request for another user's server should fail
self.alt_client.resize(self.server['id'], self.flavor_ref_alt)
@raises(exceptions.NotFound)
@attr(type='negative')
def test_create_image_for_alt_account_fails(self):
- """A create image request for another user's server should fail"""
+ # A create image request for another user's server should fail
self.alt_images_client.create_image(self.server['id'], 'testImage')
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_create_server_with_unauthorized_image(self):
- """Server creation with another user's image should fail"""
+ # Server creation with another user's image should fail
self.alt_client.create_server('test', self.image['id'],
self.flavor_ref)
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_create_server_fails_when_tenant_incorrect(self):
- """
- A create server request should fail if the tenant id does not match
- the current user
- """
+ # A create server request should fail if the tenant id does not match
+ # the current user
saved_base_url = self.alt_client.base_url
try:
# Change the base URL to impersonate another user
@@ -203,10 +197,8 @@
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_create_keypair_in_analt_user_tenant(self):
- """
- A create keypair request should fail if the tenant id does not match
- the current user
- """
+ # A create keypair request should fail if the tenant id does not match
+ # the current user
#POST keypair with other user tenant
k_name = rand_name('keypair-')
self.alt_keypairs_client._set_auth()
@@ -228,35 +220,33 @@
@raises(exceptions.NotFound)
@attr(type='negative')
def test_get_keypair_of_alt_account_fails(self):
- """A GET request for another user's keypair should fail"""
+ # A GET request for another user's keypair should fail
self.alt_keypairs_client.get_keypair(self.keypairname)
@raises(exceptions.NotFound)
@attr(type='negative')
@unittest.skip("Skipped until the Bug #1086980 is resolved")
def test_delete_keypair_of_alt_account_fails(self):
- """A DELETE request for another user's keypair should fail"""
+ # A DELETE request for another user's keypair should fail
self.alt_keypairs_client.delete_keypair(self.keypairname)
@raises(exceptions.NotFound)
@attr(type='negative')
def test_get_image_for_alt_account_fails(self):
- """A GET request for an image on another user's account should fail"""
+ # A GET request for an image on another user's account should fail
self.alt_images_client.get_image(self.image['id'])
@raises(exceptions.NotFound)
@attr(type='negative')
def test_delete_image_for_alt_account_fails(self):
- """A DELETE request for another user's image should fail"""
+ # A DELETE request for another user's image should fail
self.alt_images_client.delete_image(self.image['id'])
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_create_security_group_in_analt_user_tenant(self):
- """
- A create security group request should fail if the tenant id does not
- match the current user
- """
+ # A create security group request should fail if the tenant id does not
+ # match the current user
#POST security group with other user tenant
s_name = rand_name('security-')
s_description = rand_name('security')
@@ -281,23 +271,21 @@
@raises(exceptions.NotFound)
@attr(type='negative')
def test_get_security_group_of_alt_account_fails(self):
- """A GET request for another user's security group should fail"""
+ # A GET request for another user's security group should fail
self.alt_security_client.get_security_group(self.security_group['id'])
@raises(exceptions.NotFound)
@attr(type='negative')
def test_delete_security_group_of_alt_account_fails(self):
- """A DELETE request for another user's security group should fail"""
+ # A DELETE request for another user's security group should fail
self.alt_security_client.delete_security_group(
self.security_group['id'])
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_create_security_group_rule_in_analt_user_tenant(self):
- """
- A create security group rule request should fail if the tenant id
- does not match the current user
- """
+ # A create security group rule request should fail if the tenant id
+ # does not match the current user
#POST security group rule with other user tenant
parent_group_id = self.security_group['id']
ip_protocol = 'icmp'
@@ -328,30 +316,28 @@
@raises(exceptions.NotFound)
@attr(type='negative')
def test_delete_security_group_rule_of_alt_account_fails(self):
- """
- A DELETE request for another user's security group rule
- should fail
- """
+ # A DELETE request for another user's security group rule
+ # should fail
self.alt_security_client.delete_security_group_rule(self.rule['id'])
@raises(exceptions.NotFound)
@attr(type='negative')
def test_set_metadata_of_alt_account_server_fails(self):
- """ A set metadata for another user's server should fail """
+ # A set metadata for another user's server should fail
req_metadata = {'meta1': 'data1', 'meta2': 'data2'}
self.alt_client.set_server_metadata(self.server['id'], req_metadata)
@raises(exceptions.NotFound)
@attr(type='negative')
def test_set_metadata_of_alt_account_image_fails(self):
- """ A set metadata for another user's image should fail """
+ # A set metadata for another user's image should fail
req_metadata = {'meta1': 'value1', 'meta2': 'value2'}
self.alt_images_client.set_image_metadata(self.image['id'],
req_metadata)
@attr(type='negative')
def test_get_metadata_of_alt_account_server_fails(self):
- """ A get metadata for another user's server should fail """
+ # A get metadata for another user's server should fail
req_metadata = {'meta1': 'data1'}
self.client.set_server_metadata(self.server['id'], req_metadata)
try:
@@ -366,7 +352,7 @@
@attr(type='negative')
def test_get_metadata_of_alt_account_image_fails(self):
- """ A get metadata for another user's image should fail """
+ # 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)
@@ -382,7 +368,7 @@
@attr(type='negative')
def test_delete_metadata_of_alt_account_server_fails(self):
- """ A delete metadata for another user's server should fail """
+ # A delete metadata for another user's server should fail
req_metadata = {'meta1': 'data1'}
self.client.set_server_metadata(self.server['id'], req_metadata)
try:
@@ -397,7 +383,7 @@
@attr(type='negative')
def test_delete_metadata_of_alt_account_image_fails(self):
- """ A delete metadata for another user's image should fail """
+ # A delete metadata for another user's image should fail
req_metadata = {'meta1': 'data1'}
self.images_client.set_image_metadata(self.image['id'],
req_metadata)
@@ -415,8 +401,6 @@
@raises(exceptions.NotFound)
@attr(type='negative')
def test_get_console_output_of_alt_account_server_fails(self):
- """
- A Get Console Output for another user's server should fail
- """
+ # A Get Console Output for another user's server should fail
self.alt_console_outputs_client.get_console_output(self.server['id'],
10)
diff --git a/tempest/tests/compute/test_extensions.py b/tempest/tests/compute/test_extensions.py
index 552c58c..829e295 100644
--- a/tempest/tests/compute/test_extensions.py
+++ b/tempest/tests/compute/test_extensions.py
@@ -24,7 +24,7 @@
@attr(type='positive')
def test_list_extensions(self):
- """List of all extensions"""
+ # List of all extensions
resp, extensions = self.client.list_extensions()
self.assertTrue("extensions" in extensions)
self.assertEqual(200, resp.status)
diff --git a/tempest/tests/compute/test_live_block_migration.py b/tempest/tests/compute/test_live_block_migration.py
index 48d374f..915868c 100644
--- a/tempest/tests/compute/test_live_block_migration.py
+++ b/tempest/tests/compute/test_live_block_migration.py
@@ -104,7 +104,7 @@
@unittest.skipIf(not live_migration_available,
'Block Live migration not available')
def test_001_live_block_migration(self):
- """Live block migrate an instance to another host"""
+ # Live block migrate an instance to another host
if len(self._get_compute_hostnames()) < 2:
raise nose.SkipTest(
"Less than 2 compute nodes, skipping migration test.")
@@ -120,7 +120,7 @@
@unittest.skipIf(not live_migration_available,
'Block Live migration not available')
def test_002_invalid_host_for_migration(self):
- """Migrating to an invalid host should not change the status"""
+ # Migrating to an invalid host should not change the status
server_id = self._get_an_active_server()
target_host = self._get_non_existing_host_name()
diff --git a/tempest/tests/compute/test_quotas.py b/tempest/tests/compute/test_quotas.py
index bf7d648..3dc2515 100644
--- a/tempest/tests/compute/test_quotas.py
+++ b/tempest/tests/compute/test_quotas.py
@@ -33,7 +33,7 @@
@attr(type='smoke')
def test_get_default_quotas(self):
- """User can get the default quota set for it's tenant"""
+ # User can get the default quota set for it's tenant
expected_quota_set = {'injected_file_content_bytes': 10240,
'metadata_items': 128, 'injected_files': 5,
'ram': 51200, 'floating_ips': 10,
diff --git a/tempest/tests/compute/volumes/test_attach_volume.py b/tempest/tests/compute/volumes/test_attach_volume.py
index 09b146b..9581026 100644
--- a/tempest/tests/compute/volumes/test_attach_volume.py
+++ b/tempest/tests/compute/volumes/test_attach_volume.py
@@ -70,10 +70,8 @@
@attr(type='positive')
@unittest.skipIf(not run_ssh, 'SSH required for this test')
def test_attach_detach_volume(self):
- """
- Stop and Start a server with an attached volume, ensuring that
- the volume remains attached.
- """
+ # Stop and Start a server with an attached volume, ensuring that
+ # the volume remains attached.
server, volume = self._create_and_attach()
attached = True
diff --git a/tempest/tests/compute/volumes/test_volumes_get.py b/tempest/tests/compute/volumes/test_volumes_get.py
index 0a207b9..afb00cd 100644
--- a/tempest/tests/compute/volumes/test_volumes_get.py
+++ b/tempest/tests/compute/volumes/test_volumes_get.py
@@ -25,7 +25,7 @@
@attr(type='smoke')
def test_volume_create_get_delete(self):
- """CREATE, GET, DELETE Volume"""
+ # CREATE, GET, DELETE Volume
volume = None
try:
v_name = rand_name('Volume-%s-') % self._interface
@@ -71,7 +71,7 @@
@attr(type='positive')
def test_volume_get_metadata_none(self):
- """CREATE, GET empty metadata dict"""
+ # CREATE, GET empty metadata dict
try:
v_name = rand_name('Volume-')
#Create volume
diff --git a/tempest/tests/compute/volumes/test_volumes_list.py b/tempest/tests/compute/volumes/test_volumes_list.py
index 5162a85..fef9c8d 100644
--- a/tempest/tests/compute/volumes/test_volumes_list.py
+++ b/tempest/tests/compute/volumes/test_volumes_list.py
@@ -32,7 +32,7 @@
"""
def test_volume_list(self):
- """Should return the list of Volumes"""
+ # Should return the list of Volumes
# Fetch all Volumes
resp, fetched_list = self.client.list_volumes()
self.assertEqual(200, resp.status)
@@ -47,7 +47,7 @@
for m_vol in missing_volumes))
def test_volume_list_with_details(self):
- """Should return the list of Volumes with details"""
+ # Should return the list of Volumes with details
#Fetch all Volumes
resp, fetched_list = self.client.list_volumes_with_detail()
self.assertEqual(200, resp.status)
diff --git a/tempest/tests/compute/volumes/test_volumes_negative.py b/tempest/tests/compute/volumes/test_volumes_negative.py
index 6994ab1..d2ad30e 100644
--- a/tempest/tests/compute/volumes/test_volumes_negative.py
+++ b/tempest/tests/compute/volumes/test_volumes_negative.py
@@ -27,7 +27,7 @@
@attr(type='negative')
def test_volume_get_nonexistant_volume_id(self):
- """Negative: Should not be able to get details of nonexistant volume"""
+ # Negative: Should not be able to get details of nonexistant volume
#Creating a nonexistant volume id
volume_id_list = list()
resp, body = self.client.list_volumes()
@@ -48,7 +48,7 @@
@attr(type='negative')
def test_volume_delete_nonexistant_volume_id(self):
- """Negative: Should not be able to delete nonexistant Volume"""
+ # Negative: Should not be able to delete nonexistant Volume
#Creating nonexistant volume id
volume_id_list = list()
resp, body = self.client.list_volumes()
@@ -69,10 +69,8 @@
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_create_volume_with_invalid_size(self):
- """
- Negative: Should not be able to create volume with invalid size
- in request
- """
+ # Negative: Should not be able to create volume with invalid size
+ # in request
v_name = rand_name('Volume-')
metadata = {'Type': 'work'}
resp, volume = self.client.create_volume(size='#$%',
@@ -82,10 +80,8 @@
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_create_volume_with_out_passing_size(self):
- """
- Negative: Should not be able to create volume without passing size
- in request
- """
+ # Negative: Should not be able to create volume without passing size
+ # in request
v_name = rand_name('Volume-')
metadata = {'Type': 'work'}
resp, volume = self.client.create_volume(size='',
@@ -95,9 +91,7 @@
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_create_volume_with_size_zero(self):
- """
- Negative: Should not be able to create volume with size zero
- """
+ # Negative: Should not be able to create volume with size zero
v_name = rand_name('Volume-')
metadata = {'Type': 'work'}
resp, volume = self.client.create_volume(size='0',
@@ -107,33 +101,26 @@
@raises(exceptions.NotFound)
@attr(type='negative')
def test_get_invalid_volume_id(self):
- """
- Negative: Should not be able to get volume with invalid id
- """
+ # Negative: Should not be able to get volume with invalid id
resp, volume = self.client.get_volume('#$%%&^&^')
@raises(exceptions.NotFound)
@attr(type='negative')
def test_get_volume_without_passing_volume_id(self):
- """
- Negative: Should not be able to get volume when empty ID is passed
- """
+ # Negative: Should not be able to get volume when empty ID is passed
resp, volume = self.client.get_volume('')
@raises(exceptions.NotFound)
@attr(type='negative')
def test_delete_invalid_volume_id(self):
- """
- Negative: Should not be able to delete volume when invalid ID is passed
- """
+ # Negative: Should not be able to delete volume when invalid ID is
+ # passed
resp, volume = self.client.delete_volume('!@#$%^&*()')
@raises(exceptions.NotFound)
@attr(type='negative')
def test_delete_volume_without_passing_volume_id(self):
- """
- Negative: Should not be able to delete volume when empty ID is passed
- """
+ # Negative: Should not be able to delete volume when empty ID is passed
resp, volume = self.client.delete_volume('')
diff --git a/tempest/tests/identity/admin/test_roles.py b/tempest/tests/identity/admin/test_roles.py
index 0e1da7d..f0dd8d9 100644
--- a/tempest/tests/identity/admin/test_roles.py
+++ b/tempest/tests/identity/admin/test_roles.py
@@ -40,26 +40,26 @@
return (user, tenant, role)
def test_list_roles(self):
- """Return a list of all roles"""
+ # Return a list of all roles
resp, body = self.client.list_roles()
found = [role for role in body if role in self.data.roles]
self.assertTrue(any(found))
self.assertEqual(len(found), len(self.data.roles))
def test_list_roles_by_unauthorized_user(self):
- """Non admin user should not be able to list roles"""
+ # Non admin user should not be able to list roles
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.list_roles)
def test_list_roles_request_without_token(self):
- """Request to list roles without a valid token should fail"""
+ # Request to list roles without a valid token should fail
token = self.client.get_auth()
self.client.delete_token(token)
self.assertRaises(exceptions.Unauthorized, self.client.list_roles)
self.client.clear_auth()
def test_role_create_delete(self):
- """Role should be created, verified, and deleted"""
+ # Role should be created, verified, and deleted
role_name = rand_name('role-test-')
resp, body = self.client.create_role(role_name)
self.assertTrue('status' in resp)
@@ -79,11 +79,11 @@
self.assertFalse(any(found))
def test_role_create_blank_name(self):
- """Should not be able to create a role with a blank name"""
+ # Should not be able to create a role with a blank name
self.assertRaises(exceptions.BadRequest, self.client.create_role, '')
def test_role_create_duplicate(self):
- """Role names should be unique"""
+ # Role names should be unique
role_name = rand_name('role-dup-')
resp, body = self.client.create_role(role_name)
role1_id = body.get('id')
@@ -121,7 +121,7 @@
class UserRolesTestBase(RolesTestBase):
def test_assign_user_role(self):
- """Assign a role to a user on a tenant"""
+ # Assign a role to a user on a tenant
(user, tenant, role) = self._get_role_params()
self.client.assign_user_role(tenant['id'], user['id'], role['id'])
resp, roles = self.client.list_user_roles(tenant['id'], user['id'])
@@ -129,14 +129,14 @@
self.assertEquals(roles[0]['id'], role['id'])
def test_assign_user_role_by_unauthorized_user(self):
- """Non admin user should not be authorized to assign a role to user"""
+ # Non admin user should not be authorized to assign a role to user
(user, tenant, role) = self._get_role_params()
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.assign_user_role,
tenant['id'], user['id'], role['id'])
def test_assign_user_role_request_without_token(self):
- """Request to assign a role to a user without a valid token"""
+ # Request to assign a role to a user without a valid token
(user, tenant, role) = self._get_role_params()
token = self.client.get_auth()
self.client.delete_token(token)
@@ -146,32 +146,32 @@
self.client.clear_auth()
def test_assign_user_role_for_non_existent_user(self):
- """Attempt to assign a role to a non existent user should fail"""
+ # 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'])
def test_assign_user_role_for_non_existent_role(self):
- """Attempt to assign a non existent role to user should fail"""
+ # 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')
def test_assign_user_role_for_non_existent_tenant(self):
- """Attempt to assign a role on a non existent tenant should fail"""
+ # 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'])
def test_assign_duplicate_user_role(self):
- """Duplicate user role should not get assigned"""
+ # Duplicate user role should not get assigned
(user, tenant, role) = self._get_role_params()
self.client.assign_user_role(tenant['id'], user['id'], role['id'])
self.assertRaises(exceptions.Duplicate, self.client.assign_user_role,
tenant['id'], user['id'], role['id'])
def test_remove_user_role(self):
- """Remove a role assigned to a user on a tenant"""
+ # Remove a role assigned to a user on a tenant
(user, tenant, role) = self._get_role_params()
resp, user_role = self.client.assign_user_role(tenant['id'],
user['id'], role['id'])
@@ -180,7 +180,7 @@
self.assertEquals(resp['status'], '204')
def test_remove_user_role_by_unauthorized_user(self):
- """Non admin user should not be authorized to remove a user's role"""
+ # Non admin user should not be authorized to remove a user's role
(user, tenant, role) = self._get_role_params()
resp, user_role = self.client.assign_user_role(tenant['id'],
user['id'],
@@ -190,7 +190,7 @@
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"""
+ # Request to remove a user's role without a valid token
(user, tenant, role) = self._get_role_params()
resp, user_role = self.client.assign_user_role(tenant['id'],
user['id'],
@@ -203,7 +203,7 @@
self.client.clear_auth()
def test_remove_user_role_non_existant_user(self):
- """Attempt to remove a role from a non existent user should fail"""
+ # Attempt to remove a role from a non existent user should fail
(user, tenant, role) = self._get_role_params()
resp, user_role = self.client.assign_user_role(tenant['id'],
user['id'],
@@ -212,7 +212,7 @@
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"""
+ # Attempt to delete a non existent role from a user should fail
(user, tenant, role) = self._get_role_params()
resp, user_role = self.client.assign_user_role(tenant['id'],
user['id'],
@@ -221,7 +221,7 @@
tenant['id'], user['id'], 'junk-user-role-123')
def test_remove_user_role_non_existant_tenant(self):
- """Attempt to remove a role from a non existent tenant should fail"""
+ # Attempt to remove a role from a non existent tenant should fail
(user, tenant, role) = self._get_role_params()
resp, user_role = self.client.assign_user_role(tenant['id'],
user['id'],
@@ -230,7 +230,7 @@
'junk-tenant-id-123', user['id'], role['id'])
def test_list_user_roles(self):
- """List roles assigned to a user on tenant"""
+ # List roles assigned to a user on tenant
(user, tenant, role) = self._get_role_params()
self.client.assign_user_role(tenant['id'], user['id'], role['id'])
resp, roles = self.client.list_user_roles(tenant['id'], user['id'])
@@ -238,7 +238,7 @@
self.assertEquals(role['id'], roles[0]['id'])
def test_list_user_roles_by_unauthorized_user(self):
- """Non admin user should not be authorized to list a user's roles"""
+ # Non admin user should not be authorized to list a user's roles
(user, tenant, role) = self._get_role_params()
self.client.assign_user_role(tenant['id'], user['id'], role['id'])
self.assertRaises(exceptions.Unauthorized,
@@ -246,7 +246,7 @@
user['id'])
def test_list_user_roles_request_without_token(self):
- """Request to list user's roles without a valid token should fail"""
+ # Request to list user's roles without a valid token should fail
(user, tenant, role) = self._get_role_params()
token = self.client.get_auth()
self.client.delete_token(token)
@@ -258,7 +258,7 @@
self.client.clear_auth()
def test_list_user_roles_for_non_existent_user(self):
- """Attempt to list roles of a non existent user should fail"""
+ # 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')
diff --git a/tempest/tests/identity/admin/test_services.py b/tempest/tests/identity/admin/test_services.py
index 6baa7c2..30dfeb0 100644
--- a/tempest/tests/identity/admin/test_services.py
+++ b/tempest/tests/identity/admin/test_services.py
@@ -25,7 +25,7 @@
class ServicesTestBase(object):
def test_create_get_delete_service(self):
- """GET Service"""
+ # GET Service
try:
#Creating a Service
name = rand_name('service-')
diff --git a/tempest/tests/identity/admin/test_tenants.py b/tempest/tests/identity/admin/test_tenants.py
index 226aae6..8fba7e3 100644
--- a/tempest/tests/identity/admin/test_tenants.py
+++ b/tempest/tests/identity/admin/test_tenants.py
@@ -31,7 +31,7 @@
cls.data.tenants.append(tenant)
def test_list_tenants(self):
- """Return a list of all tenants"""
+ # Return a list of all tenants
resp, body = self.client.list_tenants()
found = [tenant for tenant in body if tenant in self.data.tenants]
self.assertTrue(any(found), 'List did not return newly created '
@@ -40,19 +40,19 @@
self.assertTrue(resp['status'].startswith('2'))
def test_list_tenants_by_unauthorized_user(self):
- """Non-admin user should not be able to list tenants"""
+ # Non-admin user should not be able to list tenants
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.list_tenants)
def test_list_tenant_request_without_token(self):
- """Request to list tenants without a valid token should fail"""
+ # Request to list tenants without a valid token should fail
token = self.client.get_auth()
self.client.delete_token(token)
self.assertRaises(exceptions.Unauthorized, self.client.list_tenants)
self.client.clear_auth()
def test_tenant_delete(self):
- """Create several tenants and delete them"""
+ # Create several tenants and delete them
tenants = []
for _ in xrange(5):
resp, body = self.client.create_tenant(rand_name('tenant-new'))
@@ -70,14 +70,14 @@
self.assertFalse(any(found_2), 'Tenants failed to delete')
def test_tenant_delete_by_unauthorized_user(self):
- """Non-admin user should not be able to delete a tenant"""
+ # Non-admin user should not be able to delete a tenant
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'])
def test_tenant_delete_request_without_token(self):
- """Request to delete a tenant without a valid token should fail"""
+ # Request to delete a tenant without a valid token should fail
tenant_name = rand_name('tenant-')
resp, tenant = self.client.create_tenant(tenant_name)
token = self.client.get_auth()
@@ -87,12 +87,12 @@
self.client.clear_auth()
def test_delete_non_existent_tenant(self):
- """Attempt to delete a non existent tenant should fail"""
+ # Attempt to delete a non existent tenant should fail
self.assertRaises(exceptions.NotFound, self.client.delete_tenant,
'junk_tenant_123456abc')
def test_tenant_create_with_description(self):
- """Create tenant with a description"""
+ # Create tenant with a description
tenant_name = rand_name('tenant-')
tenant_desc = rand_name('desc-')
resp, body = self.client.create_tenant(tenant_name,
@@ -110,7 +110,7 @@
self.client.delete_tenant(tenant_id)
def test_tenant_create_enabled(self):
- """Create a tenant that is enabled"""
+ # Create a tenant that is enabled
tenant_name = rand_name('tenant-')
resp, body = self.client.create_tenant(tenant_name, enabled=True)
tenant_id = body['id']
@@ -124,7 +124,7 @@
self.client.delete_tenant(tenant_id)
def test_tenant_create_not_enabled(self):
- """Create a tenant that is not enabled"""
+ # Create a tenant that is not enabled
tenant_name = rand_name('tenant-')
resp, body = self.client.create_tenant(tenant_name, enabled=False)
tenant_id = body['id']
@@ -140,7 +140,7 @@
self.client.delete_tenant(tenant_id)
def test_tenant_create_duplicate(self):
- """Tenant names should be unique"""
+ # Tenant names should be unique
tenant_name = rand_name('tenant-dup-')
resp, body = self.client.create_tenant(tenant_name)
tenant1_id = body.get('id')
@@ -155,13 +155,13 @@
self.client.delete_tenant(tenant1_id)
def test_create_tenant_by_unauthorized_user(self):
- """Non-admin user should not be authorized to create a tenant"""
+ # 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)
def test_create_tenant_request_without_token(self):
- """Create tenant request without a token should not be authorized"""
+ # Create tenant request without a token should not be authorized
tenant_name = rand_name('tenant-')
token = self.client.get_auth()
self.client.delete_token(token)
@@ -170,18 +170,18 @@
self.client.clear_auth()
def test_create_tenant_with_empty_name(self):
- """Tenant name should not be empty"""
+ # Tenant name should not be empty
self.assertRaises(exceptions.BadRequest, self.client.create_tenant,
name='')
def test_create_tenants_name_length_over_64(self):
- """Tenant name length should not be greater than 64 characters"""
+ # Tenant name length should not be greater than 64 characters
tenant_name = 'a' * 65
self.assertRaises(exceptions.BadRequest, self.client.create_tenant,
tenant_name)
def test_tenant_update_name(self):
- """Update name attribute of a tenant"""
+ # Update name attribute of a tenant
t_name1 = rand_name('tenant-')
resp, body = self.client.create_tenant(t_name1)
t_id = body['id']
@@ -204,7 +204,7 @@
self.client.delete_tenant(t_id)
def test_tenant_update_desc(self):
- """Update description attribute of a tenant"""
+ # Update description attribute of a tenant
t_name = rand_name('tenant-')
t_desc = rand_name('desc-')
resp, body = self.client.create_tenant(t_name, description=t_desc)
@@ -228,7 +228,7 @@
self.client.delete_tenant(t_id)
def test_tenant_update_enable(self):
- """Update the enabled attribute of a tenant"""
+ # Update the enabled attribute of a tenant
t_name = rand_name('tenant-')
t_en = False
resp, body = self.client.create_tenant(t_name, enabled=t_en)
diff --git a/tempest/tests/identity/admin/test_users.py b/tempest/tests/identity/admin/test_users.py
index e2938bd..27a214c 100644
--- a/tempest/tests/identity/admin/test_users.py
+++ b/tempest/tests/identity/admin/test_users.py
@@ -33,7 +33,7 @@
@attr(type='smoke')
def test_create_user(self):
- """Create a user"""
+ # Create a user
self.data.setup_test_tenant()
resp, user = self.client.create_user(self.alt_user, self.alt_password,
self.data.tenant['id'],
@@ -44,7 +44,7 @@
@attr(type='negative')
def test_create_user_by_unauthorized_user(self):
- """Non-admin should not be authorized to create a user"""
+ # Non-admin should not be authorized to create a user
self.data.setup_test_tenant()
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.create_user, self.alt_user,
@@ -53,7 +53,7 @@
@attr(type='negative')
def test_create_user_with_empty_name(self):
- """User with an empty name should not be created"""
+ # User with an empty name should not be created
self.data.setup_test_tenant()
self.assertRaises(exceptions.BadRequest, self.client.create_user, '',
self.alt_password, self.data.tenant['id'],
@@ -62,7 +62,7 @@
@attr(type='negative')
@unittest.skip("Until Bug 966251 is fixed")
def test_create_user_with_name_length_over_64(self):
- """Length of user name filed should be restricted to 64 characters"""
+ # 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,
@@ -70,7 +70,7 @@
@attr(type='negative')
def test_create_user_with_duplicate_name(self):
- """Duplicate user should not be created"""
+ # Duplicate user should not be created
self.data.setup_test_user()
self.assertRaises(exceptions.Duplicate, self.client.create_user,
self.data.test_user, self.data.test_password,
@@ -79,7 +79,7 @@
@attr(type='negative')
@unittest.skip("Until Bug 999084 is fixed")
def test_create_user_with_empty_password(self):
- """User with an empty password should not be created"""
+ # User with an empty password should not be created
self.data.setup_test_tenant()
self.assertRaises(exceptions.BadRequest, self.client.create_user,
self.alt_user, '', self.data.tenant['id'],
@@ -88,7 +88,7 @@
@attr(type='nagative')
@unittest.skip("Until Bug 999084 is fixed")
def test_create_user_with_long_password(self):
- """User having password exceeding max length should not be created"""
+ # User having password exceeding max length should not be created
self.data.setup_test_tenant()
self.assertRaises(exceptions.BadRequest, self.client.create_user,
self.alt_user, 'a' * 65, self.data.tenant['id'],
@@ -97,21 +97,21 @@
@attr(type='negative')
@unittest.skip("Until Bug 999084 is fixed")
def test_create_user_with_invalid_email_format(self):
- """Email format should be validated while creating a user"""
+ # 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')
@attr(type='negative')
def test_create_user_for_non_existant_tenant(self):
- """Attempt to create a user in a non-existent tenant should fail"""
+ # 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')
def test_create_user_request_without_a_token(self):
- """Request to create a user without a valid token should fail"""
+ # Request to create a user without a valid token should fail
self.data.setup_test_tenant()
# Get the token of the current client
token = self.client.get_auth()
@@ -126,7 +126,7 @@
@attr(type='smoke')
def test_delete_user(self):
- """Delete a user"""
+ # Delete a user
self.data.setup_test_tenant()
resp, user = self.client.create_user('user_1234', self.alt_password,
self.data.tenant['id'],
@@ -136,7 +136,7 @@
@attr(type='negative')
def test_delete_users_by_unauthorized_user(self):
- """Non admin user should not be authorized to delete a user"""
+ # 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,
@@ -144,13 +144,13 @@
@attr(type='negative')
def test_delete_non_existant_user(self):
- """Attempt to delete a non-existent user should fail"""
+ # Attempt to delete a non-existent user should fail
self.assertRaises(exceptions.NotFound, self.client.delete_user,
'junk12345123')
@attr(type='smoke')
def test_user_authentication(self):
- """Valid user's token is authenticated"""
+ # Valid user's token is authenticated
self.data.setup_test_user()
# Get a token
self.token_client.auth(self.data.test_user, self.data.test_password,
@@ -163,7 +163,7 @@
@attr(type='negative')
def test_authentication_for_disabled_user(self):
- """Disabled user's token should not get authenticated"""
+ # Disabled user's token should not get authenticated
self.data.setup_test_user()
self.disable_user(self.data.test_user)
self.assertRaises(exceptions.Unauthorized, self.token_client.auth,
@@ -174,7 +174,7 @@
@attr(type='negative')
@unittest.skip('Until Bug 988920 is fixed')
def test_authentication_when_tenant_is_disabled(self):
- """User's token for a disabled tenant should not be authenticated"""
+ # User's token for a disabled tenant should not be authenticated
self.data.setup_test_user()
self.disable_tenant(self.data.test_tenant)
self.assertRaises(exceptions.Unauthorized, self.token_client.auth,
@@ -185,7 +185,7 @@
@attr(type='negative')
@unittest.skip('Until Bug 988920 is fixed')
def test_authentication_with_invalid_tenant(self):
- """User's token for an invalid tenant should not be authenticated"""
+ # 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,
@@ -194,14 +194,14 @@
@attr(type='negative')
def test_authentication_with_invalid_username(self):
- """Non-existent user's token should not get authenticated"""
+ # 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)
@attr(type='negative')
def test_authentication_with_invalid_password(self):
- """User's token with invalid password should not be authenticated"""
+ # User's token with invalid password should not be authenticated
self.data.setup_test_user()
self.assertRaises(exceptions.Unauthorized, self.token_client.auth,
self.data.test_user, 'junkpass1234',
@@ -209,7 +209,7 @@
@attr(type='positive')
def test_authentication_request_without_token(self):
- """Request for token authentication with a valid token in header"""
+ # Request for token authentication with a valid token in header
self.data.setup_test_user()
self.token_client.auth(self.data.test_user, self.data.test_password,
self.data.test_tenant)
@@ -226,7 +226,7 @@
@attr(type='smoke')
def test_get_users(self):
- """Get a list of users and find the test user"""
+ # Get a list of users and find the test user
self.data.setup_test_user()
resp, users = self.client.get_users()
self.assertIn(self.data.test_user, [u['name'] for u in users],
@@ -234,14 +234,14 @@
@attr(type='negative')
def test_get_users_by_unauthorized_user(self):
- """Non admin user should not be authorized to get user list"""
+ # 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')
def test_get_users_request_without_token(self):
- """Request to get list of users without a valid token should fail"""
+ # Request to get list of users without a valid token should fail
token = self.client.get_auth()
self.client.delete_token(token)
self.assertRaises(exceptions.Unauthorized, self.client.get_users)
@@ -249,7 +249,7 @@
@attr(type='positive')
def test_list_users_for_tenant(self):
- """Return a list of all users for a tenant"""
+ # Return a list of all users for a tenant
self.data.setup_test_tenant()
user_ids = list()
fetched_user_ids = list()
@@ -277,7 +277,7 @@
@attr(type='positive')
def test_list_users_with_roles_for_tenant(self):
- """Return list of users on tenant when roles are assigned to users"""
+ # Return list of users on tenant when roles are assigned to users
self.data.setup_test_user()
self.data.setup_test_role()
user = self.get_user_by_name(self.data.test_user)
@@ -309,10 +309,8 @@
@attr(type='negative')
def test_list_users_with_invalid_tenant(self):
- """
- Should not be able to return a list of all
- users for a nonexistant tenant
- """
+ # Should not be able to return a list of all
+ # users for a nonexistant tenant
#Assign invalid tenant ids
invalid_id = list()
invalid_id.append(rand_name('999'))
diff --git a/tempest/tests/identity/base.py b/tempest/tests/identity/base.py
index 3867f0a..ce160da 100644
--- a/tempest/tests/identity/base.py
+++ b/tempest/tests/identity/base.py
@@ -95,7 +95,7 @@
self.role_name = None
def setup_test_user(self):
- """Set up a test user"""
+ """Set up a test user."""
self.setup_test_tenant()
self.test_user = rand_name('test_user_')
self.test_password = rand_name('pass_')
@@ -107,7 +107,7 @@
self.users.append(self.user)
def setup_test_tenant(self):
- """Set up a test tenant"""
+ """Set up a test tenant."""
self.test_tenant = rand_name('test_tenant_')
self.test_description = rand_name('desc_')
resp, self.tenant = self.client.create_tenant(
@@ -116,7 +116,7 @@
self.tenants.append(self.tenant)
def setup_test_role(self):
- """Set up a test role"""
+ """Set up a test role."""
self.test_role = rand_name('role')
resp, self.role = self.client.create_role(self.test_role)
self.roles.append(self.role)
diff --git a/tempest/tests/image/test_images.py b/tempest/tests/image/test_images.py
index a3c9390..2429a32 100644
--- a/tempest/tests/image/test_images.py
+++ b/tempest/tests/image/test_images.py
@@ -54,7 +54,7 @@
@attr(type='image')
def test_register_with_invalid_data(self):
- """Negative tests for invalid data supplied to POST /images"""
+ # Negative tests for invalid data supplied to POST /images
metas = [
{
@@ -76,7 +76,7 @@
@attr(type='image')
def test_register_then_upload(self):
- """Register, then upload an image"""
+ # Register, then upload an image
meta = {
'name': 'New Name',
'is_public': True,
@@ -108,7 +108,7 @@
@attr(type='image')
def test_register_remote_image(self):
- """Register a new remote image"""
+ # Register a new remote image
meta = {
'name': 'New Remote Image',
'is_public': True,
@@ -194,8 +194,6 @@
@attr(type='image')
def test_index_no_params(self):
- """
- Simple test to see all fixture images returned
- """
+ # Simple test to see all fixture images returned
current_images = set(i.id for i in self.client.images.list())
self.assertTrue(set(self.created_images) <= current_images)
diff --git a/tempest/tests/network/base.py b/tempest/tests/network/base.py
index f993441..90b351d 100644
--- a/tempest/tests/network/base.py
+++ b/tempest/tests/network/base.py
@@ -48,7 +48,7 @@
cls.client.delete_network(network['id'])
def create_network(self, network_name=None):
- """Wrapper utility that returns a test network"""
+ """Wrapper utility that returns a test network."""
network_name = network_name or rand_name('test-network')
resp, body = self.client.create_network(network_name)
diff --git a/tempest/tests/network/test_networks.py b/tempest/tests/network/test_networks.py
index 5476551..d7f09c4 100644
--- a/tempest/tests/network/test_networks.py
+++ b/tempest/tests/network/test_networks.py
@@ -31,7 +31,7 @@
@attr(type='positive')
def test_create_delete_network(self):
- """Creates and deletes a network for a tenant"""
+ # Creates and deletes a network for a tenant
name = rand_name('network')
resp, body = self.client.create_network(name)
self.assertEqual('202', resp['status'])
@@ -42,7 +42,7 @@
@attr(type='positive')
def test_show_network(self):
- """Verifies the details of a network"""
+ # Verifies the details of a network
resp, body = self.client.get_network(self.network['id'])
self.assertEqual('200', resp['status'])
network = body['network']
@@ -51,7 +51,7 @@
@attr(type='positive')
def test_show_network_details(self):
- """Verifies the full details of a network"""
+ # Verifies the full details of a network
resp, body = self.client.get_network_details(self.network['id'])
self.assertEqual('200', resp['status'])
network = body['network']
@@ -61,7 +61,7 @@
@attr(type='positive')
def test_list_networks(self):
- """Verify the network exists in the list of all networks"""
+ # Verify the network exists in the list of all networks
resp, body = self.client.list_networks()
networks = body['networks']
found = any(n for n in networks if n['id'] == self.network['id'])
@@ -69,7 +69,7 @@
@attr(type='positive')
def test_list_networks_with_detail(self):
- """Verify the network exists in the detailed list of all networks"""
+ # Verify the network exists in the detailed list of all networks
resp, body = self.client.list_networks_details()
networks = body['networks']
found = any(n for n in networks if n['id'] == self.network['id'])
diff --git a/tempest/tests/object_storage/test_account_services.py b/tempest/tests/object_storage/test_account_services.py
index db3aa69..cae2da1 100644
--- a/tempest/tests/object_storage/test_account_services.py
+++ b/tempest/tests/object_storage/test_account_services.py
@@ -36,7 +36,7 @@
@attr(type='smoke')
def test_list_containers(self):
- """List of all containers should not be empty"""
+ # List of all containers should not be empty
params = {'format': 'json'}
resp, container_list = \
@@ -48,7 +48,7 @@
@attr(type='smoke')
def test_list_account_metadata(self):
- """List all account metadata"""
+ # List all account metadata
resp, metadata = self.account_client.list_account_metadata()
self.assertEqual(resp['status'], '204')
@@ -58,7 +58,7 @@
@attr(type='smoke')
def test_create_account_metadata(self):
- """Add metadata to account"""
+ # Add metadata to account
metadata = {'test-account-meta': 'Meta!'}
resp, _ = \
@@ -71,7 +71,7 @@
@attr(type='smoke')
def test_delete_account_metadata(self):
- """Delete metadata from account"""
+ # Delete metadata from account
metadata = ['test-account-meta']
resp, _ = \
diff --git a/tempest/tests/object_storage/test_container_services.py b/tempest/tests/object_storage/test_container_services.py
index b99859e..fe09341 100644
--- a/tempest/tests/object_storage/test_container_services.py
+++ b/tempest/tests/object_storage/test_container_services.py
@@ -46,7 +46,7 @@
@attr(type='smoke')
def test_create_container(self):
- """Create a container, test responses"""
+ # Create a container, test responses
#Create a container
container_name = rand_name(name='TestContainer')
@@ -57,7 +57,7 @@
@attr(type='smoke')
def test_delete_container(self):
- """Create and Delete a container, test responses"""
+ # Create and Delete a container, test responses
#Create a container
container_name = rand_name(name='TestContainer')
@@ -71,7 +71,7 @@
@attr(type='smoke')
def test_list_container_contents_json(self):
- """Add metadata to object"""
+ # Add metadata to object
#Create a container
container_name = rand_name(name='TestContainer')
@@ -107,7 +107,7 @@
@attr(type='smoke')
def test_container_metadata(self):
- """Update/Retrieve/Delete Container Metadata"""
+ # Update/Retrieve/Delete Container Metadata
# Create a container
container_name = rand_name(name='TestContainer')
diff --git a/tempest/tests/object_storage/test_object_expiry.py b/tempest/tests/object_storage/test_object_expiry.py
index 8437d55..099fc16 100644
--- a/tempest/tests/object_storage/test_object_expiry.py
+++ b/tempest/tests/object_storage/test_object_expiry.py
@@ -57,7 +57,7 @@
@unittest.skip('Until bug 1069849 is resolved.')
@attr(type='regression')
def test_get_object_after_expiry_time(self):
- """GET object after expiry time"""
+ # GET object after expiry time
#TODO(harika-vakadi): Similar test case has to be created for
# "X-Delete-At", after this test case works.
diff --git a/tempest/tests/object_storage/test_object_services.py b/tempest/tests/object_storage/test_object_services.py
index 43af072..8b87ad6 100644
--- a/tempest/tests/object_storage/test_object_services.py
+++ b/tempest/tests/object_storage/test_object_services.py
@@ -49,7 +49,7 @@
@attr(type='smoke')
def test_create_object(self):
- """Create storage object, test response"""
+ # Create storage object, test response
#Create Object
object_name = rand_name(name='TestObject')
@@ -66,7 +66,7 @@
@attr(type='smoke')
def test_delete_object(self):
- """Create and delete a storage object, test responses"""
+ # Create and delete a storage object, test responses
#Create Object
object_name = rand_name(name='TestObject')
@@ -80,7 +80,7 @@
@attr(type='smoke')
def test_object_metadata(self):
- """Add metadata to storage object, test if metadata is retrievable"""
+ # Add metadata to storage object, test if metadata is retrievable
#Create Object
object_name = rand_name(name='TestObject')
@@ -110,7 +110,7 @@
@attr(type='smoke')
def test_get_object(self):
- """Retrieve object's data(in response body)"""
+ # Retrieve object's data(in response body)
#Create Object
object_name = rand_name(name='TestObject')
@@ -126,7 +126,7 @@
@attr(type='smoke')
def test_copy_object_in_same_container(self):
- """Copy storage object"""
+ # Copy storage object
# Create source Object
src_object_name = rand_name(name='SrcObject')
@@ -154,7 +154,7 @@
@attr(type='smoke')
def test_copy_object_to_itself(self):
- """Change the content type of an existing object"""
+ # Change the content type of an existing object
# Create Object
object_name = rand_name(name='TestObject')
@@ -179,7 +179,7 @@
@attr(type='smoke')
def test_copy_object_2d_way(self):
- """Copy storage object"""
+ # Copy storage object
# Create source Object
src_object_name = rand_name(name='SrcObject')
@@ -208,7 +208,7 @@
@attr(type='smoke')
def test_copy_object_across_containers(self):
- """Copy storage object across containers"""
+ # Copy storage object across containers
#Create a container so as to use as source container
src_container_name = rand_name(name='TestSourceContainer')
@@ -267,8 +267,8 @@
@attr(type='smoke')
def test_access_public_container_object_without_using_creds(self):
- """Make container public-readable, and access the object
- anonymously, e.g. without using credentials"""
+ # Make container public-readable, and access the object
+ # anonymously, e.g. without using credentials
try:
resp_meta = None
@@ -318,8 +318,8 @@
@attr(type='negative')
def test_access_object_without_using_creds(self):
- """Attempt to access the object anonymously, e.g.
- not using any credentials"""
+ # Attempt to access the object anonymously, e.g.
+ # not using any credentials
# Create Object
object_name = rand_name(name='Object')
@@ -336,8 +336,8 @@
@attr(type='negative')
def test_write_object_without_using_creds(self):
- """Attempt to write to the object anonymously, e.g.
- not using any credentials"""
+ # Attempt to write to the object anonymously, e.g.
+ # not using any credentials
# Trying to Create Object with empty Headers
object_name = rand_name(name='Object')
@@ -353,8 +353,8 @@
@attr(type='negative')
def test_delete_object_without_using_creds(self):
- """Attempt to delete the object anonymously,
- e.g. not using any credentials"""
+ # Attempt to delete the object anonymously,
+ # e.g. not using any credentials
# Create Object
object_name = rand_name(name='Object')
diff --git a/tempest/tests/object_storage/test_object_version.py b/tempest/tests/object_storage/test_object_version.py
index a291ae7..28e0893 100644
--- a/tempest/tests/object_storage/test_object_version.py
+++ b/tempest/tests/object_storage/test_object_version.py
@@ -54,7 +54,7 @@
@attr(type='smoke')
def test_versioned_container(self):
- """Versioned container responses tests"""
+ # Versioned container responses tests
# Create a containers
vers_container_name = rand_name(name='TestVersionContainer')
diff --git a/tempest/tests/utils.py b/tempest/tests/utils.py
index 8adaa51..571fc2a 100644
--- a/tempest/tests/utils.py
+++ b/tempest/tests/utils.py
@@ -15,7 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-"""Common utilities used in testing"""
+"""Common utilities used in testing."""
import nose.plugins.skip
diff --git a/tempest/tests/volume/admin/base.py b/tempest/tests/volume/admin/base.py
index 420da42..81c7c78 100644
--- a/tempest/tests/volume/admin/base.py
+++ b/tempest/tests/volume/admin/base.py
@@ -27,7 +27,7 @@
class BaseVolumeAdminTest(BaseVolumeTest):
- """Base test case class for all Volume Admin API tests"""
+ """Base test case class for all Volume Admin API tests."""
@classmethod
def setUpClass(cls):
super(BaseVolumeAdminTest, cls).setUpClass()
diff --git a/tempest/tests/volume/admin/test_volume_types.py b/tempest/tests/volume/admin/test_volume_types.py
index 224a927..8ebb78f 100644
--- a/tempest/tests/volume/admin/test_volume_types.py
+++ b/tempest/tests/volume/admin/test_volume_types.py
@@ -41,7 +41,7 @@
super(VolumeTypesTest, cls).tearDownClass()
def test_volume_type_list(self):
- """List Volume types."""
+ # List Volume types.
try:
resp, body = self.client.list_volume_types()
self.assertEqual(200, resp.status)
@@ -50,7 +50,7 @@
self.fail("Could not list volume types")
def test_create_get_delete_volume_with_volume_type_and_extra_specs(self):
- """ Create/get/delete volume with volume_type and extra spec. """
+ # Create/get/delete volume with volume_type and extra spec.
try:
volume = {}
vol_name = rand_name("volume-")
@@ -101,7 +101,7 @@
self.assertEqual(202, resp.status)
def test_volume_type_create_delete(self):
- """ Create/Delete volume type."""
+ # Create/Delete volume type.
try:
name = rand_name("volume-type-")
extra_specs = {"Spec1": "Val1", "Spec2": "Val2"}
@@ -122,7 +122,7 @@
self.fail("Could not create a volume_type")
def test_volume_type_create_get(self):
- """ Create/get volume type."""
+ # Create/get volume type.
try:
body = {}
name = rand_name("volume-type-")
diff --git a/tempest/tests/volume/admin/test_volume_types_extra_specs.py b/tempest/tests/volume/admin/test_volume_types_extra_specs.py
index 181c37c..9734c42 100644
--- a/tempest/tests/volume/admin/test_volume_types_extra_specs.py
+++ b/tempest/tests/volume/admin/test_volume_types_extra_specs.py
@@ -47,7 +47,7 @@
cls.client.delete_volume_type(cls.volume_type['id'])
def test_volume_type_extra_specs_list(self):
- """List Volume types extra specs."""
+ # List Volume types extra specs.
try:
resp, body = self.client.\
list_volume_types_extra_specs(self.volume_type['id'])
@@ -59,7 +59,7 @@
self.fail("Could not list volume types extra specs")
def test_volume_type_extra_specs_update(self):
- """ Update volume type extra specs"""
+ # Update volume type extra specs
try:
extra_spec = {"spec1": "val2"}
resp, body = self.client.\
@@ -75,7 +75,7 @@
self.fail("Couldnt update volume type extra spec")
def test_volume_type_extra_spec_create_delete(self):
- """ Create/Delete volume type extra spec."""
+ # Create/Delete volume type extra spec.
try:
extra_specs = {"spec2": "val1"}
resp, body = self.client.\
@@ -91,7 +91,7 @@
self.fail("Could not create a volume_type extra spec")
def test_volume_type_extra_spec_create_get(self):
- """ Create/get volume type extra spec"""
+ # Create/get volume type extra spec
try:
extra_specs = {"spec1": "val1"}
resp, body = self.client.\
diff --git a/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py b/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py
index bfbfaae..d139425 100644
--- a/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py
+++ b/tempest/tests/volume/admin/test_volume_types_extra_specs_negative.py
@@ -46,7 +46,7 @@
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_update_no_body(self):
- """ Should not update volume type extra specs with no body"""
+ # Should not update volume type extra specs with no body
extra_spec = {"spec1": "val2"}
self.client.update_volume_type_extra_specs(self.volume_type['id'],
extra_spec.keys()[0],
@@ -55,7 +55,7 @@
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_update_nonexistent_extra_spec_id(self):
- """ Should not update volume type extra specs with nonexistent id."""
+ # Should not update volume type extra specs with nonexistent id.
extra_spec = {"spec1": "val2"}
self.client.update_volume_type_extra_specs(self.volume_type['id'],
str(uuid.uuid4()),
@@ -64,7 +64,7 @@
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_update_none_extra_spec_id(self):
- """ Should not update volume type extra specs with none id."""
+ # Should not update volume type extra specs with none id.
extra_spec = {"spec1": "val2"}
self.client.update_volume_type_extra_specs(self.volume_type['id'],
None, extra_spec)
@@ -72,9 +72,8 @@
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_update_multiple_extra_spec(self):
- """ Should not update volume type extra specs with multiple specs as
- body.
- """
+ # Should not update volume type extra specs with multiple specs as
+ # body.
extra_spec = {"spec1": "val2", 'spec2': 'val1'}
self.client.update_volume_type_extra_specs(self.volume_type['id'],
extra_spec.keys()[0],
@@ -83,9 +82,8 @@
@raises(exceptions.NotFound)
@attr(type='negative')
def test_create_nonexistent_type_id(self):
- """ Should not create volume type extra spec for nonexistent volume
- type id.
- """
+ # Should not create volume type extra spec for nonexistent volume
+ # type id.
extra_specs = {"spec2": "val1"}
self.client.create_volume_type_extra_specs(str(uuid.uuid4()),
extra_specs)
@@ -94,7 +92,7 @@
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_create_none_body(self):
- """ Should not create volume type extra spec for none POST body."""
+ # Should not create volume type extra spec for none POST body.
self.client.create_volume_type_extra_specs(self.volume_type['id'],
None)
@@ -102,16 +100,15 @@
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_create_invalid_body(self):
- """ Should not create volume type extra spec for invalid POST body."""
+ # Should not create volume type extra spec for invalid POST body.
self.client.create_volume_type_extra_specs(self.volume_type['id'],
['invalid'])
@raises(exceptions.NotFound)
@attr(type='negative')
def test_delete_nonexistent_volume_type_id(self):
- """ Should not delete volume type extra spec for nonexistent
- type id.
- """
+ # Should not delete volume type extra spec for nonexistent
+ # type id.
extra_specs = {"spec1": "val1"}
self.client.delete_volume_type_extra_specs(str(uuid.uuid4()),
extra_specs.keys()[0])
@@ -119,13 +116,13 @@
@raises(exceptions.NotFound)
@attr(type='negative')
def test_list_nonexistent_volume_type_id(self):
- """ Should not list volume type extra spec for nonexistent type id."""
+ # Should not list volume type extra spec for nonexistent type id.
self.client.list_volume_types_extra_specs(str(uuid.uuid4()))
@raises(exceptions.NotFound)
@attr(type='negative')
def test_get_nonexistent_volume_type_id(self):
- """ Should not get volume type extra spec for nonexistent type id."""
+ # Should not get volume type extra spec for nonexistent type id.
extra_specs = {"spec1": "val1"}
self.client.get_volume_type_extra_specs(str(uuid.uuid4()),
extra_specs.keys()[0])
@@ -133,9 +130,8 @@
@raises(exceptions.NotFound)
@attr(type='negative')
def test_get_nonexistent_extra_spec_id(self):
- """ Should not get volume type extra spec for nonexistent extra spec
- id.
- """
+ # Should not get volume type extra spec for nonexistent extra spec
+ # id.
self.client.get_volume_type_extra_specs(self.volume_type['id'],
str(uuid.uuid4()))
diff --git a/tempest/tests/volume/admin/test_volume_types_negative.py b/tempest/tests/volume/admin/test_volume_types_negative.py
index 91237fc..c2daef9 100644
--- a/tempest/tests/volume/admin/test_volume_types_negative.py
+++ b/tempest/tests/volume/admin/test_volume_types_negative.py
@@ -35,8 +35,7 @@
@raises(exceptions.NotFound)
@attr(type='negative')
def test_create_with_nonexistent_volume_type(self):
- """ Should not be able to create volume with nonexistent volume_type.
- """
+ # Should not be able to create volume with nonexistent volume_type.
self.volumes_client.create_volume(size=1,
display_name=str(uuid.uuid4()),
volume_type=str(uuid.uuid4()))
@@ -45,20 +44,19 @@
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_create_with_empty_name(self):
- """ Should not be able to create volume type with an empty name."""
+ # Should not be able to create volume type with an empty name.
self.client.create_volume_type('')
@raises(exceptions.NotFound)
@attr(type='negative')
def test_get_nonexistent_type_id(self):
- """ Should not be able to get volume type with nonexistent type id."""
+ # Should not be able to get volume type with nonexistent type id.
self.client.get_volume_type(str(uuid.uuid4()))
@raises(exceptions.NotFound)
@attr(type='negative')
def test_delete_nonexistent_type_id(self):
- """ Should not be able to delete volume type with nonexistent type id.
- """
+ # Should not be able to delete volume type with nonexistent type id.
self.client.delete_volume_type(str(uuid.uuid4()))
diff --git a/tempest/tests/volume/base.py b/tempest/tests/volume/base.py
index 549f541..8657db8 100644
--- a/tempest/tests/volume/base.py
+++ b/tempest/tests/volume/base.py
@@ -31,7 +31,7 @@
class BaseVolumeTest(unittest.TestCase):
- """Base test case class for all Cinder API tests"""
+ """Base test case class for all Cinder API tests."""
@classmethod
def setUpClass(cls):
@@ -122,7 +122,7 @@
cls.clear_isolated_creds()
def create_volume(self, size=1, metadata={}):
- """Wrapper utility that returns a test volume"""
+ """Wrapper utility that returns a test volume."""
display_name = rand_name(self.__class__.__name__ + "-volume")
cli_resp = self.volumes_client.create_volume(size=size,
display_name=display_name,
@@ -133,7 +133,7 @@
return volume
def wait_for(self, condition):
- """Repeatedly calls condition() until a timeout"""
+ """Repeatedly calls condition() until a timeout."""
start_time = int(time.time())
while True:
try:
diff --git a/tempest/tests/volume/test_volumes_actions.py b/tempest/tests/volume/test_volumes_actions.py
index 52c270c..7eddb67 100644
--- a/tempest/tests/volume/test_volumes_actions.py
+++ b/tempest/tests/volume/test_volumes_actions.py
@@ -50,7 +50,7 @@
@attr(type='smoke')
def test_attach_detach_volume_to_instance(self):
- """Volume is attached and detached successfully from an instance"""
+ # Volume is attached and detached successfully from an instance
try:
mountpoint = '/dev/vdc'
resp, body = self.client.attach_volume(self.volume['id'],
@@ -67,7 +67,7 @@
self.client.wait_for_volume_status(self.volume['id'], 'available')
def test_get_volume_attachment(self):
- """Verify that a volume's attachment information is retrieved"""
+ # Verify that a volume's attachment information is retrieved
mountpoint = '/dev/vdc'
resp, body = self.client.attach_volume(self.volume['id'],
self.server['id'],
diff --git a/tempest/tests/volume/test_volumes_get.py b/tempest/tests/volume/test_volumes_get.py
index 048c340..bc64ff4 100644
--- a/tempest/tests/volume/test_volumes_get.py
+++ b/tempest/tests/volume/test_volumes_get.py
@@ -25,7 +25,7 @@
@attr(type='smoke')
def test_volume_create_get_delete(self):
- """Create a volume, Get it's details and Delete the volume"""
+ # Create a volume, Get it's details and Delete the volume
try:
volume = {}
v_name = rand_name('Volume-')
@@ -69,7 +69,7 @@
@attr(type='positive')
def test_volume_get_metadata_none(self):
- """Create a volume without passing metadata, get details, and delete"""
+ # Create a volume without passing metadata, get details, and delete
try:
volume = {}
v_name = rand_name('Volume-')
diff --git a/tempest/tests/volume/test_volumes_list.py b/tempest/tests/volume/test_volumes_list.py
index b387b15..26a85b7 100644
--- a/tempest/tests/volume/test_volumes_list.py
+++ b/tempest/tests/volume/test_volumes_list.py
@@ -34,7 +34,7 @@
@attr(type='smoke')
def test_volume_list(self):
- """Get a list of Volumes"""
+ # Get a list of Volumes
# Fetch all volumes
resp, fetched_list = self.client.list_volumes()
self.assertEqual(200, resp.status)
@@ -47,7 +47,7 @@
@attr(type='smoke')
def test_volume_list_with_details(self):
- """Get a list of Volumes with details"""
+ # Get a list of Volumes with details
# Fetch all Volumes
resp, fetched_list = self.client.list_volumes_with_detail()
self.assertEqual(200, resp.status)
diff --git a/tempest/tests/volume/test_volumes_negative.py b/tempest/tests/volume/test_volumes_negative.py
index 2c8b006..6bd7002 100644
--- a/tempest/tests/volume/test_volumes_negative.py
+++ b/tempest/tests/volume/test_volumes_negative.py
@@ -28,7 +28,7 @@
@raises(exceptions.NotFound)
@attr(type='negative')
def test_volume_get_nonexistant_volume_id(self):
- """Should not be able to get a nonexistant volume"""
+ # Should not be able to get a nonexistant volume
#Creating a nonexistant volume id
volume_id_list = []
resp, volumes = self.client.list_volumes()
@@ -44,7 +44,7 @@
@raises(exceptions.NotFound)
@attr(type='negative')
def test_volume_delete_nonexistant_volume_id(self):
- """Should not be able to delete a nonexistant Volume"""
+ # Should not be able to delete a nonexistant Volume
# Creating nonexistant volume id
volume_id_list = []
resp, volumes = self.client.list_volumes()
@@ -60,10 +60,8 @@
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_create_volume_with_invalid_size(self):
- """
- Should not be able to create volume with invalid size
- in request
- """
+ # Should not be able to create volume with invalid size
+ # in request
v_name = rand_name('Volume-')
metadata = {'Type': 'work'}
resp, volume = self.client.create_volume(size='#$%',
@@ -73,10 +71,8 @@
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_create_volume_with_out_passing_size(self):
- """
- Should not be able to create volume without passing size
- in request
- """
+ # Should not be able to create volume without passing size
+ # in request
v_name = rand_name('Volume-')
metadata = {'Type': 'work'}
resp, volume = self.client.create_volume(size='',
@@ -86,9 +82,7 @@
@raises(exceptions.BadRequest)
@attr(type='negative')
def test_create_volume_with_size_zero(self):
- """
- Should not be able to create volume with size zero
- """
+ # Should not be able to create volume with size zero
v_name = rand_name('Volume-')
metadata = {'Type': 'work'}
resp, volume = self.client.create_volume(size='0',
@@ -98,33 +92,25 @@
@raises(exceptions.NotFound)
@attr(type='negative')
def test_get_invalid_volume_id(self):
- """
- Should not be able to get volume with invalid id
- """
+ # Should not be able to get volume with invalid id
resp, volume = self.client.get_volume('#$%%&^&^')
@raises(exceptions.NotFound)
@attr(type='negative')
def test_get_volume_without_passing_volume_id(self):
- """
- Should not be able to get volume when empty ID is passed
- """
+ # Should not be able to get volume when empty ID is passed
resp, volume = self.client.get_volume('')
@raises(exceptions.NotFound)
@attr(type='negative')
def test_delete_invalid_volume_id(self):
- """
- Should not be able to delete volume when invalid ID is passed
- """
+ # Should not be able to delete volume when invalid ID is passed
resp, volume = self.client.delete_volume('!@#$%^&*()')
@raises(exceptions.NotFound)
@attr(type='negative')
def test_delete_volume_without_passing_volume_id(self):
- """
- Should not be able to delete volume when empty ID is passed
- """
+ # Should not be able to delete volume when empty ID is passed
resp, volume = self.client.delete_volume('')
diff --git a/tempest/whitebox.py b/tempest/whitebox.py
index 39cd666..d78b9e0 100644
--- a/tempest/whitebox.py
+++ b/tempest/whitebox.py
@@ -106,7 +106,7 @@
@classmethod
def create_server(cls, image_id=None):
- """Wrapper utility that returns a test server"""
+ """Wrapper utility that returns a test server."""
server_name = rand_name(cls.__name__ + "-instance")
flavor = cls.flavor_ref
if not image_id:
@@ -120,7 +120,7 @@
@classmethod
def get_db_handle_and_meta(cls, database='nova'):
- """Return a connection handle and metadata of an OpenStack database"""
+ """Return a connection handle and metadata of an OpenStack database."""
engine_args = {"echo": False,
"convert_unicode": True,
"pool_recycle": 3600
@@ -138,7 +138,7 @@
return connection, meta
def nova_manage(self, category, action, params):
- """Executes nova-manage command for the given action"""
+ """Executes nova-manage command for the given action."""
nova_manage_path = os.path.join(self.compute_bin_dir, 'nova-manage')
cmd = ' '.join([nova_manage_path, category, action, params])
@@ -161,7 +161,7 @@
return result
def get_ssh_connection(self, host, username, password):
- """Create an SSH connection object to a host"""
+ """Create an SSH connection object to a host."""
ssh_timeout = self.config.compute.ssh_timeout
ssh_client = Client(host, username, password, ssh_timeout)
if not ssh_client.test_connection_auth():
diff --git a/tools/hacking.py b/tools/hacking.py
index 6e66005..617682d 100755
--- a/tools/hacking.py
+++ b/tools/hacking.py
@@ -36,13 +36,13 @@
# Don't need this for testing
logging.disable('LOG')
-#N1xx comments
-#N2xx except
-#N3xx imports
-#N4xx docstrings
-#N5xx dictionaries/lists
-#N6xx calling methods
-#N7xx localization
+#T1xx comments
+#T2xx except
+#T3xx imports
+#T4xx docstrings
+#T5xx dictionaries/lists
+#T6xx calling methods
+#T7xx localization
#N8xx git commit messages
IMPORT_EXCEPTIONS = ['sqlalchemy', 'migrate']
@@ -110,13 +110,13 @@
tempest HACKING guide recommendation for TODO:
Include your name with TODOs as in "#TODO(termie)"
- N101
+ T101
"""
pos = physical_line.find('TODO')
pos1 = physical_line.find('TODO(')
pos2 = physical_line.find('#') # make sure it's a comment
if (pos != pos1 and pos2 >= 0 and pos2 < pos):
- return pos, "TEMPEST N101: Use TODO(NAME)"
+ return pos, "T101: Use TODO(NAME)"
def tempest_except_format(logical_line):
@@ -124,10 +124,10 @@
tempest HACKING guide recommends not using except:
Do not write "except:", use "except Exception:" at the very least
- N201
+ T201
"""
if logical_line.startswith("except:"):
- yield 6, "TEMPEST N201: no 'except:' at least use 'except Exception:'"
+ yield 6, "T201: no 'except:' at least use 'except Exception:'"
def tempest_except_format_assert(logical_line):
@@ -135,10 +135,10 @@
tempest HACKING guide recommends not using assertRaises(Exception...):
Do not use overly broad Exception type
- N202
+ T202
"""
if logical_line.startswith("self.assertRaises(Exception"):
- yield 1, "TEMPEST N202: assertRaises Exception too broad"
+ yield 1, "T202: assertRaises Exception too broad"
def tempest_one_import_per_line(logical_line):
@@ -149,14 +149,14 @@
Examples:
BAD: from tempest.common.rest_client import RestClient, RestClientXML
- N301
+ T301
"""
pos = logical_line.find(',')
parts = logical_line.split()
if (pos > -1 and (parts[0] == "import" or
parts[0] == "from" and parts[2] == "import") and
not is_import_exception(parts[1])):
- yield pos, "TEMPEST N301: one import per line"
+ yield pos, "T301: one import per line"
_missingImport = set([])
@@ -166,9 +166,9 @@
tempest HACKING guide recommends importing only modules:
Do not import objects, only modules
- N302 import only modules
- N303 Invalid Import
- N304 Relative Import
+ T302 import only modules
+ T303 Invalid Import
+ T304 Relative Import
"""
def importModuleCheck(mod, parent=None, added=False):
"""
@@ -193,12 +193,12 @@
if added:
sys.path.pop()
added = False
- return logical_line.find(mod), ("TEMPEST N304: No "
+ return logical_line.find(mod), ("T304: No "
"relative imports. "
"'%s' is a relative "
"import"
% logical_line)
- return logical_line.find(mod), ("TEMPEST N302: import only"
+ return logical_line.find(mod), ("T302: import only"
" modules. '%s' does not "
"import a module"
% logical_line)
@@ -222,7 +222,7 @@
except AttributeError:
# Invalid import
- return logical_line.find(mod), ("TEMPEST N303: Invalid import, "
+ return logical_line.find(mod), ("T303: Invalid import, "
"AttributeError raised")
# convert "from x import y" to " import x.y"
@@ -240,7 +240,7 @@
# TODO(jogo) handle "from x import *"
-#TODO(jogo): import template: N305
+#TODO(jogo): import template: T305
def tempest_import_alphabetical(logical_line, line_number, lines):
@@ -248,7 +248,7 @@
Tempest HACKING guide recommendation for imports:
imports in human alphabetical order
- N306
+ T306
"""
# handle import x
# use .lower since capitalization shouldn't dictate order
@@ -260,7 +260,7 @@
if (len(split_line) in length and len(split_previous) in length and
split_line[0] == "import" and split_previous[0] == "import"):
if split_line[1] < split_previous[1]:
- yield (0, "TEMPEST N306: imports not in alphabetical order"
+ yield (0, "T306: imports not in alphabetical order"
" (%s, %s)"
% (split_previous[1], split_line[1]))
@@ -270,12 +270,13 @@
tempest HACKING guide recommendation for docstring:
Docstring should not start with space
- N401
+ T401
"""
pos = max([physical_line.find(i) for i in DOCSTRING_TRIPLE]) # start
- if (pos != -1 and len(physical_line) > pos + 1):
+ end = max([physical_line[-4:-1] == i for i in DOCSTRING_TRIPLE]) # end
+ if (pos != -1 and end and len(physical_line) > pos + 4):
if (physical_line[pos + 3] == ' '):
- return (pos, "TEMPEST N401: one line docstring should not start"
+ return (pos, "T401: one line docstring should not start"
" with a space")
@@ -284,13 +285,13 @@
tempest HACKING guide recommendation for one line docstring:
A one line docstring looks like this and ends in a period.
- N402
+ T402
"""
pos = max([physical_line.find(i) for i in DOCSTRING_TRIPLE]) # start
end = max([physical_line[-4:-1] == i for i in DOCSTRING_TRIPLE]) # end
if (pos != -1 and end and len(physical_line) > pos + 4):
if (physical_line[-5] != '.'):
- return pos, "TEMPEST N402: one line docstring needs a period"
+ return pos, "T402: one line docstring needs a period"
def tempest_docstring_multiline_end(physical_line):
@@ -298,12 +299,29 @@
Tempest HACKING guide recommendation for docstring:
Docstring should end on a new line
- N403
+ T403
"""
pos = max([physical_line.find(i) for i in DOCSTRING_TRIPLE]) # start
if (pos != -1 and len(physical_line) == pos):
if (physical_line[pos + 3] == ' '):
- return (pos, "TEMPEST N403: multi line docstring end on new line")
+ return (pos, "T403: multi line docstring end on new line")
+
+
+def tempest_no_test_docstring(physical_line, previous_logical, filename):
+ """Check that test_ functions don't have docstrings
+
+ This ensure we get better results out of tempest, instead
+ of them being hidden behind generic descriptions of the
+ functions.
+
+ T404
+ """
+ if "tempest/test" in filename:
+ pos = max([physical_line.find(i) for i in DOCSTRING_TRIPLE])
+ if pos != -1:
+ if previous_logical.startswith("def test_"):
+ return (pos, "T404: test functions must "
+ "not have doc strings")
FORMAT_RE = re.compile("%(?:"
@@ -353,25 +371,25 @@
if not format_string:
raise LocalizationError(start,
- "TEMEPST N701: Empty localization "
+ "T701: Empty localization "
"string")
if token_type != tokenize.OP:
raise LocalizationError(start,
- "TEMPEST N701: Invalid localization "
+ "T701: Invalid localization "
"call")
if text != ")":
if text == "%":
raise LocalizationError(start,
- "TEMPEST N702: Formatting "
+ "T702: Formatting "
"operation should be outside"
" of localization method call")
elif text == "+":
raise LocalizationError(start,
- "TEMPEST N702: Use bare string "
+ "T702: Use bare string "
"concatenation instead of +")
else:
raise LocalizationError(start,
- "TEMPEST N702: Argument to _ must"
+ "T702: Argument to _ must"
" be just a string")
format_specs = FORMAT_RE.findall(format_string)
@@ -380,16 +398,16 @@
# not spec means %%, key means %(smth)s
if len(positional_specs) > 1:
raise LocalizationError(start,
- "TEMPEST N703: Multiple positional "
+ "T703: Multiple positional "
"placeholders")
def tempest_localization_strings(logical_line, tokens):
"""Check localization in line.
- N701: bad localization call
- N702: complex expression instead of string as argument to _()
- N703: multiple positional placeholders
+ T701: bad localization call
+ T702: complex expression instead of string as argument to _()
+ T703: multiple positional placeholders
"""
gen = check_i18n()
@@ -431,8 +449,8 @@
tempest HACKING recommends not referencing a bug or blueprint
in first line, it should provide an accurate description of the change
- N801
- N802 Title limited to 50 chars
+ T801
+ T802 Title limited to 50 chars
"""
#Get title of most recent commit
@@ -453,12 +471,12 @@
error = False
#NOTE(jogo) if match regex but over 3 words, acceptable title
if GIT_REGEX.search(title) is not None and len(title.split()) <= 3:
- print ("N801: git commit title ('%s') should provide an accurate "
+ print ("T801: git commit title ('%s') should provide an accurate "
"description of the change, not just a reference to a bug "
"or blueprint" % title.strip())
error = True
if len(title.decode('utf-8')) > 72:
- print ("N802: git commit title ('%s') should be under 50 chars"
+ print ("T802: git commit title ('%s') should be under 50 chars"
% title.strip())
error = True
return error
@@ -468,8 +486,8 @@
sys.path.append(os.getcwd())
#Run once tests (not per line)
once_error = once_git_check_commit_title()
- #TEMPEST error codes start with an N
- pep8.ERRORCODE_REGEX = re.compile(r'[EWN]\d{3}')
+ #TEMPEST error codes start with a T
+ pep8.ERRORCODE_REGEX = re.compile(r'[EWT]\d{3}')
add_tempest()
pep8.current_file = current_file
pep8.readlines = readlines
diff --git a/tox.ini b/tox.ini
index 991842c..33ca1c4 100644
--- a/tox.ini
+++ b/tox.ini
@@ -20,4 +20,4 @@
[testenv:pep8]
deps = pep8==1.3.3
-commands = python tools/hacking.py --ignore=N4,E122,E125,E126 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack,*egg .
+commands = python tools/hacking.py --ignore=E122,E125,E126 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack,*egg .