Fix H404/405 violations for api tests(1/3)
There is a lot of H404/405 violations in Tempest now, and that leads
difficult to migrate the code to tempest-lib or the other projects'
repos. This patch fixes these violations for api tests except compute
and network.
Change-Id: I783862867732b76d836153bf9ef18fb4a5ec6c6e
diff --git a/tempest/api/baremetal/admin/base.py b/tempest/api/baremetal/admin/base.py
index d7d2efe..80b69b9 100644
--- a/tempest/api/baremetal/admin/base.py
+++ b/tempest/api/baremetal/admin/base.py
@@ -98,8 +98,7 @@
@classmethod
@creates('chassis')
def create_chassis(cls, description=None, expect_errors=False):
- """
- Wrapper utility for creating test chassis.
+ """Wrapper utility for creating test chassis.
:param description: A description of the chassis. if not supplied,
a random value will be generated.
@@ -114,8 +113,7 @@
@creates('node')
def create_node(cls, chassis_id, cpu_arch='x86', cpus=8, local_gb=10,
memory_mb=4096):
- """
- Wrapper utility for creating test baremetal nodes.
+ """Wrapper utility for creating test baremetal nodes.
:param cpu_arch: CPU architecture of the node. Default: x86.
:param cpus: Number of CPUs. Default: 8.
@@ -134,8 +132,7 @@
@classmethod
@creates('port')
def create_port(cls, node_id, address, extra=None, uuid=None):
- """
- Wrapper utility for creating test ports.
+ """Wrapper utility for creating test ports.
:param address: MAC address of the port.
:param extra: Meta data of the port. If not supplied, an empty
@@ -152,8 +149,7 @@
@classmethod
def delete_chassis(cls, chassis_id):
- """
- Deletes a chassis having the specified UUID.
+ """Deletes a chassis having the specified UUID.
:param uuid: The unique identifier of the chassis.
:return: Server response.
@@ -169,8 +165,7 @@
@classmethod
def delete_node(cls, node_id):
- """
- Deletes a node having the specified UUID.
+ """Deletes a node having the specified UUID.
:param uuid: The unique identifier of the node.
:return: Server response.
@@ -186,8 +181,7 @@
@classmethod
def delete_port(cls, port_id):
- """
- Deletes a port having the specified UUID.
+ """Deletes a port having the specified UUID.
:param uuid: The unique identifier of the port.
:return: Server response.
diff --git a/tempest/api/compute/admin/test_baremetal_nodes.py b/tempest/api/compute/admin/test_baremetal_nodes.py
index 2599d86..b764483 100644
--- a/tempest/api/compute/admin/test_baremetal_nodes.py
+++ b/tempest/api/compute/admin/test_baremetal_nodes.py
@@ -20,9 +20,7 @@
class BaremetalNodesAdminTestJSON(base.BaseV2ComputeAdminTest):
- """
- Tests Baremetal API
- """
+ """Tests Baremetal API"""
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index dfaa5d5..993d39e 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -22,10 +22,7 @@
class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
-
- """
- Tests Servers API using admin privileges
- """
+ """Tests Servers API using admin privileges"""
_host_key = 'OS-EXT-SRV-ATTR:host'
diff --git a/tempest/api/compute/admin/test_services_negative.py b/tempest/api/compute/admin/test_services_negative.py
index 0c81ccb..e57401a 100644
--- a/tempest/api/compute/admin/test_services_negative.py
+++ b/tempest/api/compute/admin/test_services_negative.py
@@ -19,10 +19,7 @@
class ServicesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
-
- """
- Tests Services API. List and Enable/Disable require admin privileges.
- """
+ """Tests Services API. List and Enable/Disable require admin privileges."""
@classmethod
def setup_clients(cls):
diff --git a/tempest/api/data_processing/base.py b/tempest/api/data_processing/base.py
index 5d78539..4e88f65 100644
--- a/tempest/api/data_processing/base.py
+++ b/tempest/api/data_processing/base.py
@@ -399,6 +399,7 @@
@classmethod
def _get_default_version(cls):
"""Returns the default plugin version used for testing.
+
This is gathered separately from the plugin to allow
the usage of plugin name in skip_checks. This method is
rather invoked into resource_setup, which allows API calls
@@ -439,6 +440,7 @@
@classmethod
def get_cluster_template(cls, node_group_template_ids=None):
"""Returns a cluster template for the default plugin.
+
node_group_template_defined contains the type and ID of pre-defined
node group templates that have to be used in the cluster template
(instead of dynamically defining them with 'node_processes').
diff --git a/tempest/api/data_processing/test_cluster_templates.py b/tempest/api/data_processing/test_cluster_templates.py
index 42cbd14..dfd8e27 100644
--- a/tempest/api/data_processing/test_cluster_templates.py
+++ b/tempest/api/data_processing/test_cluster_templates.py
@@ -19,9 +19,9 @@
class ClusterTemplateTest(dp_base.BaseDataProcessingTest):
- """Link to the API documentation is http://docs.openstack.org/developer/
- sahara/restapi/rest_api_v1.0.html#cluster-templates
- """
+ # Link to the API documentation is http://docs.openstack.org/developer/
+ # sahara/restapi/rest_api_v1.0.html#cluster-templates
+
@classmethod
def skip_checks(cls):
super(ClusterTemplateTest, cls).skip_checks()
diff --git a/tempest/api/data_processing/test_job_binaries.py b/tempest/api/data_processing/test_job_binaries.py
index 98b7e24..a47ddbc 100644
--- a/tempest/api/data_processing/test_job_binaries.py
+++ b/tempest/api/data_processing/test_job_binaries.py
@@ -18,9 +18,9 @@
class JobBinaryTest(dp_base.BaseDataProcessingTest):
- """Link to the API documentation is http://docs.openstack.org/developer/
- sahara/restapi/rest_api_v1.1_EDP.html#job-binaries
- """
+ # Link to the API documentation is http://docs.openstack.org/developer/
+ # sahara/restapi/rest_api_v1.1_EDP.html#job-binaries
+
@classmethod
def resource_setup(cls):
super(JobBinaryTest, cls).resource_setup()
diff --git a/tempest/api/data_processing/test_job_binary_internals.py b/tempest/api/data_processing/test_job_binary_internals.py
index 6919fa5..b4f0769 100644
--- a/tempest/api/data_processing/test_job_binary_internals.py
+++ b/tempest/api/data_processing/test_job_binary_internals.py
@@ -18,9 +18,9 @@
class JobBinaryInternalTest(dp_base.BaseDataProcessingTest):
- """Link to the API documentation is http://docs.openstack.org/developer/
- sahara/restapi/rest_api_v1.1_EDP.html#job-binary-internals
- """
+ # Link to the API documentation is http://docs.openstack.org/developer/
+ # sahara/restapi/rest_api_v1.1_EDP.html#job-binary-internals
+
@classmethod
def resource_setup(cls):
super(JobBinaryInternalTest, cls).resource_setup()
diff --git a/tempest/api/data_processing/test_jobs.py b/tempest/api/data_processing/test_jobs.py
index 7798056..8503320 100644
--- a/tempest/api/data_processing/test_jobs.py
+++ b/tempest/api/data_processing/test_jobs.py
@@ -18,9 +18,9 @@
class JobTest(dp_base.BaseDataProcessingTest):
- """Link to the API documentation is http://docs.openstack.org/developer/
- sahara/restapi/rest_api_v1.1_EDP.html#jobs
- """
+ # NOTE: Link to the API documentation: http://docs.openstack.org/developer/
+ # sahara/restapi/rest_api_v1.1_EDP.html#jobs
+
@classmethod
def resource_setup(cls):
super(JobTest, cls).resource_setup()
diff --git a/tempest/api/identity/admin/v2/test_tokens.py b/tempest/api/identity/admin/v2/test_tokens.py
index e808990..0e7a480 100644
--- a/tempest/api/identity/admin/v2/test_tokens.py
+++ b/tempest/api/identity/admin/v2/test_tokens.py
@@ -52,8 +52,9 @@
@test.idempotent_id('25ba82ee-8a32-4ceb-8f50-8b8c71e8765e')
def test_rescope_token(self):
- """An unscoped token can be requested, that token can be used to
- request a scoped token.
+ """An unscoped token can be requested
+
+ That token can be used to request a scoped token.
"""
# Create a user.
diff --git a/tempest/api/image/admin/v2/test_images.py b/tempest/api/image/admin/v2/test_images.py
index 09877ba..01838b6 100644
--- a/tempest/api/image/admin/v2/test_images.py
+++ b/tempest/api/image/admin/v2/test_images.py
@@ -26,10 +26,8 @@
class BasicAdminOperationsImagesTest(base.BaseV2ImageAdminTest):
+ """Here we test admin operations of images"""
- """
- Here we test admin operations of images
- """
@testtools.skipUnless(CONF.image_feature_enabled.deactivate_image,
'deactivate-image is not available.')
@test.idempotent_id('951ebe01-969f-4ea9-9898-8a3f1f442ab0')
diff --git a/tempest/api/image/v1/test_images.py b/tempest/api/image/v1/test_images.py
index d4dbfcd..64f3174 100644
--- a/tempest/api/image/v1/test_images.py
+++ b/tempest/api/image/v1/test_images.py
@@ -100,10 +100,7 @@
class ListImagesTest(base.BaseV1ImageTest):
-
- """
- Here we test the listing of image information
- """
+ """Here we test the listing of image information"""
@classmethod
def resource_setup(cls):
@@ -131,10 +128,8 @@
@classmethod
def _create_remote_image(cls, name, container_format, disk_format):
- """
- Create a new remote image and return the ID of the newly-registered
- image
- """
+ """Create a new remote image and return newly-registered image-id"""
+
name = 'New Remote Image %s' % name
location = CONF.image.http_image
image = cls.create_image(name=name,
@@ -148,9 +143,9 @@
@classmethod
def _create_standard_image(cls, name, container_format,
disk_format, size):
- """
- Create a new standard image and return the ID of the newly-registered
- image. Note that the size of the new image is a random number between
+ """Create a new standard image and return newly-registered image-id
+
+ Note that the size of the new image is a random number between
1024 and 4096
"""
image_file = moves.cStringIO(data_utils.random_bytes(size))
@@ -241,10 +236,8 @@
@classmethod
def _create_standard_image(cls, name, container_format,
disk_format, size):
- """
- Create a new standard image and return the ID of the newly-registered
- image.
- """
+ """Create a new standard image and return newly-registered image-id"""
+
image_file = moves.cStringIO(data_utils.random_bytes(size))
name = 'New Standard Image %s' % name
image = cls.create_image(name=name,
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index bacf211..936eadf 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -29,17 +29,15 @@
class BasicOperationsImagesTest(base.BaseV2ImageTest):
- """
- Here we test the basic operations of images
- """
+ """Here we test the basic operations of images"""
@test.attr(type='smoke')
@test.idempotent_id('139b765e-7f3d-4b3d-8b37-3ca3876ee318')
def test_register_upload_get_image_file(self):
+ """Here we test these functionalities
- """
- Here we test these functionalities - Register image,
- upload the image file, get image and get image file api's
+ Register image, upload the image file, get image and get image
+ file api's
"""
uuid = '00000000-1111-2222-3333-444455556666'
@@ -135,9 +133,7 @@
class ListImagesTest(base.BaseV2ImageTest):
- """
- Here we test the listing of image information
- """
+ """Here we test the listing of image information"""
@classmethod
def resource_setup(cls):
@@ -158,9 +154,9 @@
@classmethod
def _create_standard_image(cls, container_format, disk_format):
- """
- Create a new standard image and return the ID of the newly-registered
- image. Note that the size of the new image is a random number between
+ """Create a new standard image and return the newly-registered image-id
+
+ Note that the size of the new image is a random number between
1024 and 4096
"""
size = random.randint(1024, 4096)
@@ -176,9 +172,8 @@
return image_id
def _list_by_param_value_and_assert(self, params):
- """
- Perform list action with given params and validates result.
- """
+ """Perform list action with given params and validates result."""
+
images_list = self.client.list_images(params=params)['images']
# Validating params of fetched images
for image in images_list:
diff --git a/tempest/api/image/v2/test_images_metadefs_namespaces.py b/tempest/api/image/v2/test_images_metadefs_namespaces.py
index 21247b1..d089c84 100644
--- a/tempest/api/image/v2/test_images_metadefs_namespaces.py
+++ b/tempest/api/image/v2/test_images_metadefs_namespaces.py
@@ -20,9 +20,8 @@
class MetadataNamespacesTest(base.BaseV2ImageTest):
- """
- Here we will test the Metadata definition Namespaces basic functionality.
- """
+ """Test the Metadata definition Namespaces basic functionality"""
+
@test.idempotent_id('319b765e-7f3d-4b3d-8b37-3ca3876ee768')
def test_basic_metadata_definition_namespaces(self):
# get the available resource types and use one resource_type
diff --git a/tempest/api/image/v2/test_images_negative.py b/tempest/api/image/v2/test_images_negative.py
index c5c5e8b..71c8c7a 100644
--- a/tempest/api/image/v2/test_images_negative.py
+++ b/tempest/api/image/v2/test_images_negative.py
@@ -24,8 +24,7 @@
class ImagesNegativeTest(base.BaseV2ImageTest):
- """
- here we have -ve tests for show_image and delete_image api
+ """here we have -ve tests for show_image and delete_image api
Tests
** get non-existent image
diff --git a/tempest/api/messaging/base.py b/tempest/api/messaging/base.py
index 64a7fd5..39dc7c3 100644
--- a/tempest/api/messaging/base.py
+++ b/tempest/api/messaging/base.py
@@ -26,8 +26,7 @@
class BaseMessagingTest(test.BaseTestCase):
- """
- Base class for the Messaging tests that use the Tempest Zaqar REST client
+ """Base class for the Messaging (Zaqar) tests
It is assumed that the following option is defined in the
[service_available] section of etc/tempest.conf
diff --git a/tempest/api/object_storage/base.py b/tempest/api/object_storage/base.py
index 41a7d65..2621581 100644
--- a/tempest/api/object_storage/base.py
+++ b/tempest/api/object_storage/base.py
@@ -90,10 +90,8 @@
pass
def assertHeaders(self, resp, target, method):
- """
- Common method to check the existence and the format of common response
- headers
- """
+ """Check the existence and the format of response headers"""
+
self.assertThat(resp, custom_matchers.ExistsAllResponseHeaders(
target, method))
self.assertThat(resp, custom_matchers.AreAllWellFormatted())
diff --git a/tempest/api/object_storage/test_account_quotas.py b/tempest/api/object_storage/test_account_quotas.py
index 78707d8..0f6a330 100644
--- a/tempest/api/object_storage/test_account_quotas.py
+++ b/tempest/api/object_storage/test_account_quotas.py
@@ -92,8 +92,7 @@
@test.idempotent_id('63f51f9f-5f1d-4fc6-b5be-d454d70949d6')
@test.requires_ext(extension='account_quotas', service='object')
def test_admin_modify_quota(self):
- """Test that the ResellerAdmin is able to modify and remove the quota
- on a user's account.
+ """Test ResellerAdmin can modify/remove the quota on a user's account
Using the account client, the test modifies the quota
successively to:
diff --git a/tempest/api/object_storage/test_account_quotas_negative.py b/tempest/api/object_storage/test_account_quotas_negative.py
index 2bf331a..aee17d3 100644
--- a/tempest/api/object_storage/test_account_quotas_negative.py
+++ b/tempest/api/object_storage/test_account_quotas_negative.py
@@ -83,9 +83,7 @@
@test.idempotent_id('d1dc5076-555e-4e6d-9697-28f1fe976324')
@test.requires_ext(extension='account_quotas', service='object')
def test_user_modify_quota(self):
- """Test that a user is not able to modify or remove a quota on
- its account.
- """
+ """Test that a user cannot modify or remove a quota on its account."""
# Not able to remove quota
self.assertRaises(lib_exc.Forbidden,
diff --git a/tempest/api/orchestration/stacks/test_non_empty_stack.py b/tempest/api/orchestration/stacks/test_non_empty_stack.py
index e37587c..4bc2c17 100644
--- a/tempest/api/orchestration/stacks/test_non_empty_stack.py
+++ b/tempest/api/orchestration/stacks/test_non_empty_stack.py
@@ -91,8 +91,7 @@
@test.idempotent_id('c951d55e-7cce-4c1f-83a0-bad735437fa6')
def test_list_resources(self):
- """Getting list of created resources for the stack should be possible.
- """
+ """Get list of created resources for the stack should be possible."""
resources = self.list_resources(self.stack_identifier)
self.assertEqual({self.resource_name: self.resource_type}, resources)
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index 8f07614..81f00ec 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -112,8 +112,8 @@
super(BaseTelemetryTest, cls).resource_cleanup()
def await_samples(self, metric, query):
- """
- This method is to wait for sample to add it to database.
+ """This method is to wait for sample to add it to database.
+
There are long time delays when using Postgresql (or Mysql)
database as ceilometer backend
"""
diff --git a/tempest/api/telemetry/test_alarming_api_negative.py b/tempest/api/telemetry/test_alarming_api_negative.py
index 7d5a0bf..06753b0 100644
--- a/tempest/api/telemetry/test_alarming_api_negative.py
+++ b/tempest/api/telemetry/test_alarming_api_negative.py
@@ -21,8 +21,8 @@
class TelemetryAlarmingNegativeTest(base.BaseTelemetryTest):
- """here we have negative tests for show_alarm, update_alarm, show_alarm_history
- Tests
+ """Negative tests for show_alarm, update_alarm, show_alarm_history tests
+
** show non-existent alarm
** show the deleted alarm
** delete deleted alarm
diff --git a/tempest/api/volume/admin/test_volume_services.py b/tempest/api/volume/admin/test_volume_services.py
index 74fffb9..6692594 100644
--- a/tempest/api/volume/admin/test_volume_services.py
+++ b/tempest/api/volume/admin/test_volume_services.py
@@ -18,8 +18,8 @@
class VolumesServicesV2TestJSON(base.BaseVolumeAdminTest):
- """
- Tests Volume Services API.
+ """Tests Volume Services API.
+
volume service list requires admin privileges.
"""
diff --git a/tempest/api/volume/test_availability_zone.py b/tempest/api/volume/test_availability_zone.py
index 366b8d2..fe51375 100644
--- a/tempest/api/volume/test_availability_zone.py
+++ b/tempest/api/volume/test_availability_zone.py
@@ -18,10 +18,7 @@
class AvailabilityZoneV2TestJSON(base.BaseVolumeTest):
-
- """
- Tests Availability Zone V2 API List
- """
+ """Tests Availability Zone V2 API List"""
@classmethod
def setup_clients(cls):
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index 620366a..b776494 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -26,14 +26,11 @@
class VolumesV2ListTestJSON(base.BaseVolumeTest):
-
- """
- This test creates a number of 1G volumes. To run successfully,
- ensure that the backing file for the volume group that Nova uses
- has space for at least 3 1G volumes!
- If you are running a Devstack environment, ensure that the
- VOLUME_BACKING_FILE_SIZE is at least 4G in your localrc
- """
+ # NOTE: This test creates a number of 1G volumes. To run successfully,
+ # ensure that the backing file for the volume group that Nova uses
+ # has space for at least 3 1G volumes!
+ # If you are running a Devstack environment, ensure that the
+ # VOLUME_BACKING_FILE_SIZE is at least 4G in your localrc
VOLUME_FIELDS = ('id', 'name')
@@ -83,10 +80,7 @@
super(VolumesV2ListTestJSON, cls).resource_cleanup()
def _list_by_param_value_and_assert(self, params, with_detail=False):
- """
- Perform list or list_details action with given params
- and validates result.
- """
+ """list or list_details with given params and validates result"""
if with_detail:
fetched_vol_list = \
self.client.list_volumes(detail=True, params=params)['volumes']
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 9866da3..856adcc 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -43,10 +43,8 @@
self.volumes_client.wait_for_volume_status(volume_id, 'available')
def _list_by_param_values_and_assert(self, params, with_detail=False):
- """
- Perform list or list_details action with given params
- and validates result.
- """
+ """list or list_details with given params and validates result."""
+
if with_detail:
fetched_snap_list = self.snapshots_client.list_snapshots(
detail=True, params=params)['snapshots']
diff --git a/tempest/api/volume/v2/test_volumes_list.py b/tempest/api/volume/v2/test_volumes_list.py
index 94a9d16..6568627 100644
--- a/tempest/api/volume/v2/test_volumes_list.py
+++ b/tempest/api/volume/v2/test_volumes_list.py
@@ -21,9 +21,7 @@
class VolumesV2ListTestJSON(base.BaseVolumeTest):
-
- """
- volumes v2 specific tests.
+ """volumes v2 specific tests.
This test creates a number of 1G volumes. To run successfully,
ensure that the backing file for the volume group that Nova uses