diff --git a/tempest/api/object_storage/test_container_acl_negative.py b/tempest/api/object_storage/test_container_acl_negative.py index 90b24b41f7..73d7f27a71 100644 --- a/tempest/api/object_storage/test_container_acl_negative.py +++ b/tempest/api/object_storage/test_container_acl_negative.py @@ -22,6 +22,7 @@ CONF = config.CONF class ObjectACLsNegativeTest(base.BaseObjectTest): + """Negative tests of object ACLs""" credentials = [['operator', CONF.object_storage.operator_role], ['operator_alt', CONF.object_storage.operator_role]] @@ -48,6 +49,7 @@ class ObjectACLsNegativeTest(base.BaseObjectTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('af587587-0c24-4e15-9822-8352ce711013') def test_write_object_without_using_creds(self): + """Test writing object without using credentials""" # trying to create object with empty headers # X-Auth-Token is not provided object_name = data_utils.rand_name(name='Object') @@ -62,6 +64,7 @@ class ObjectACLsNegativeTest(base.BaseObjectTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('af85af0b-a025-4e72-a90e-121babf55720') def test_delete_object_without_using_creds(self): + """Test deleting object without using credentials""" # create object object_name = data_utils.rand_name(name='Object') self.object_client.create_object(self.container_name, object_name, @@ -79,7 +82,7 @@ class ObjectACLsNegativeTest(base.BaseObjectTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('63d84e37-55a6-42e2-9e5f-276e60e26a00') def test_write_object_with_non_authorized_user(self): - # attempt to upload another file using non-authorized user + """Test writing object with non-authorized user""" # User provided token is forbidden. ACL are not set object_name = data_utils.rand_name(name='Object') # trying to create object with non-authorized user @@ -94,7 +97,7 @@ class ObjectACLsNegativeTest(base.BaseObjectTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('abf63359-be52-4feb-87dd-447689fc77fd') def test_read_object_with_non_authorized_user(self): - # attempt to read object using non-authorized user + """Test reading object with non-authorized user""" # User provided token is forbidden. ACL are not set object_name = data_utils.rand_name(name='Object') resp, _ = self.object_client.create_object( @@ -112,7 +115,7 @@ class ObjectACLsNegativeTest(base.BaseObjectTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('7343ac3d-cfed-4198-9bb0-00149741a492') def test_delete_object_with_non_authorized_user(self): - # attempt to delete object using non-authorized user + """Test deleting object with non-authorized user""" # User provided token is forbidden. ACL are not set object_name = data_utils.rand_name(name='Object') resp, _ = self.object_client.create_object( @@ -130,7 +133,7 @@ class ObjectACLsNegativeTest(base.BaseObjectTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('9ed01334-01e9-41ea-87ea-e6f465582823') def test_read_object_without_rights(self): - # attempt to read object using non-authorized user + """Test reading object without rights""" # update X-Container-Read metadata ACL cont_headers = {'X-Container-Read': 'badtenant:baduser'} resp_meta, _ = ( @@ -155,7 +158,7 @@ class ObjectACLsNegativeTest(base.BaseObjectTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('a3a585a7-d8cf-4b65-a1a0-edc2b1204f85') def test_write_object_without_rights(self): - # attempt to write object using non-authorized user + """Test writing object without rights""" # update X-Container-Write metadata ACL cont_headers = {'X-Container-Write': 'badtenant:baduser'} resp_meta, _ = ( @@ -177,7 +180,7 @@ class ObjectACLsNegativeTest(base.BaseObjectTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('8ba512ad-aa6e-444e-b882-2906a0ea2052') def test_write_object_without_write_rights(self): - # attempt to write object using non-authorized user + """Test writing object without write rights""" # update X-Container-Read and X-Container-Write metadata ACL tenant_name = self.os_operator.credentials.tenant_name username = self.os_operator.credentials.username @@ -203,7 +206,7 @@ class ObjectACLsNegativeTest(base.BaseObjectTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('b4e366f8-f185-47ab-b789-df4416f9ecdb') def test_delete_object_without_write_rights(self): - # attempt to delete object using non-authorized user + """Test deleting object without write rights""" # update X-Container-Read and X-Container-Write metadata ACL tenant_name = self.os_operator.credentials.tenant_name username = self.os_operator.credentials.username diff --git a/tempest/api/object_storage/test_container_services_negative.py b/tempest/api/object_storage/test_container_services_negative.py index b8c83b7cc0..31c33db9af 100644 --- a/tempest/api/object_storage/test_container_services_negative.py +++ b/tempest/api/object_storage/test_container_services_negative.py @@ -25,6 +25,7 @@ CONF = config.CONF class ContainerNegativeTest(base.BaseObjectTest): + """Negative tests of containers""" @classmethod def resource_setup(cls): @@ -41,7 +42,7 @@ class ContainerNegativeTest(base.BaseObjectTest): CONF.object_storage_feature_enabled.discoverability, 'Discoverability function is disabled') def test_create_container_name_exceeds_max_length(self): - # Attempts to create a container name that is longer than max + """Test creating container with name longer than max""" max_length = self.constraints['max_container_name_length'] # create a container with long name container_name = data_utils.arbitrary_string(size=max_length + 1) @@ -58,8 +59,7 @@ class ContainerNegativeTest(base.BaseObjectTest): CONF.object_storage_feature_enabled.discoverability, 'Discoverability function is disabled') def test_create_container_metadata_name_exceeds_max_length(self): - # Attempts to create container with metadata name - # that is longer than max. + """Test creating container with metadata name longer than max""" max_length = self.constraints['max_meta_name_length'] container_name = data_utils.rand_name(name='TestContainer') metadata_name = 'X-Container-Meta-' + data_utils.arbitrary_string( @@ -77,8 +77,7 @@ class ContainerNegativeTest(base.BaseObjectTest): CONF.object_storage_feature_enabled.discoverability, 'Discoverability function is disabled') def test_create_container_metadata_value_exceeds_max_length(self): - # Attempts to create container with metadata value - # that is longer than max. + """Test creating container with metadata value longer than max""" max_length = self.constraints['max_meta_value_length'] container_name = data_utils.rand_name(name='TestContainer') metadata_value = data_utils.arbitrary_string(size=max_length + 1) @@ -95,8 +94,7 @@ class ContainerNegativeTest(base.BaseObjectTest): CONF.object_storage_feature_enabled.discoverability, 'Discoverability function is disabled') def test_create_container_metadata_exceeds_overall_metadata_count(self): - # Attempts to create container with metadata that exceeds the - # default count + """Test creating container with metadata exceeding default count""" max_count = self.constraints['max_meta_count'] container_name = data_utils.rand_name(name='TestContainer') metadata = {} @@ -113,8 +111,7 @@ class ContainerNegativeTest(base.BaseObjectTest): @decorators.attr(type=["negative"]) @decorators.idempotent_id('1a95ab2e-b712-4a98-8a4d-8ce21b7557d6') def test_get_metadata_headers_with_invalid_container_name(self): - # Attempts to retrieve metadata headers with an invalid - # container name. + """Test getting metadata headers with invalid container name""" self.assertRaises(exceptions.NotFound, self.container_client.list_container_metadata, 'invalid_container_name') @@ -122,7 +119,7 @@ class ContainerNegativeTest(base.BaseObjectTest): @decorators.attr(type=["negative"]) @decorators.idempotent_id('125a24fa-90a7-4cfc-b604-44e49d788390') def test_update_metadata_with_nonexistent_container_name(self): - # Attempts to update metadata using a nonexistent container name. + """Test updating metadata using a nonexistent container name""" metadata = {'animal': 'penguin'} self.assertRaises( @@ -133,7 +130,7 @@ class ContainerNegativeTest(base.BaseObjectTest): @decorators.attr(type=["negative"]) @decorators.idempotent_id('65387dbf-a0e2-4aac-9ddc-16eb3f1f69ba') def test_delete_with_nonexistent_container_name(self): - # Attempts to delete metadata using a nonexistent container name. + """Test deleting metadata using a non existent container name""" metadata = {'animal': 'penguin'} self.assertRaises( @@ -144,8 +141,7 @@ class ContainerNegativeTest(base.BaseObjectTest): @decorators.attr(type=["negative"]) @decorators.idempotent_id('14331d21-1e81-420a-beea-19cb5e5207f5') def test_list_all_container_objects_with_nonexistent_container(self): - # Attempts to get a listing of all objects on a container - # that doesn't exist. + """Test getting a list of all objects on a non existent container""" params = {'limit': 9999, 'format': 'json'} self.assertRaises(exceptions.NotFound, self.container_client.list_container_objects, @@ -154,8 +150,7 @@ class ContainerNegativeTest(base.BaseObjectTest): @decorators.attr(type=["negative"]) @decorators.idempotent_id('86b2ab08-92d5-493d-acd2-85f0c848819e') def test_list_all_container_objects_on_deleted_container(self): - # Attempts to get a listing of all objects on a container - # that was deleted. + """Test getting a list of all objects on a deleted container""" container_name = self.create_container() # delete container resp, _ = self.container_client.delete_container(container_name) @@ -168,6 +163,7 @@ class ContainerNegativeTest(base.BaseObjectTest): @decorators.attr(type=["negative"]) @decorators.idempotent_id('42da116e-1e8c-4c96-9e06-2f13884ed2b1') def test_delete_non_empty_container(self): + """Test deleting a container with object in it""" # create a container and an object within it # attempt to delete a container that isn't empty. container_name = self.create_container() diff --git a/tempest/api/object_storage/test_container_staticweb.py b/tempest/api/object_storage/test_container_staticweb.py index 1243b838fb..ef98ed83c3 100644 --- a/tempest/api/object_storage/test_container_staticweb.py +++ b/tempest/api/object_storage/test_container_staticweb.py @@ -21,6 +21,7 @@ from tempest.lib import exceptions as lib_exc class StaticWebTest(base.BaseObjectTest): + """Test static web""" @classmethod def resource_setup(cls): @@ -47,6 +48,7 @@ class StaticWebTest(base.BaseObjectTest): @decorators.idempotent_id('c1f055ab-621d-4a6a-831f-846fcb578b8b') @utils.requires_ext(extension='staticweb', service='object') def test_web_index(self): + """Test web index""" headers = {'web-index': self.object_name} self.container_client.create_update_or_delete_container_metadata( @@ -79,6 +81,7 @@ class StaticWebTest(base.BaseObjectTest): @decorators.idempotent_id('941814cf-db9e-4b21-8112-2b6d0af10ee5') @utils.requires_ext(extension='staticweb', service='object') def test_web_listing(self): + """Test web listing""" headers = {'web-listings': 'true'} self.container_client.create_update_or_delete_container_metadata( @@ -111,6 +114,7 @@ class StaticWebTest(base.BaseObjectTest): @decorators.idempotent_id('bc37ec94-43c8-4990-842e-0e5e02fc8926') @utils.requires_ext(extension='staticweb', service='object') def test_web_listing_css(self): + """Test web listing css""" headers = {'web-listings': 'true', 'web-listings-css': 'listings.css'} @@ -134,6 +138,7 @@ class StaticWebTest(base.BaseObjectTest): @decorators.idempotent_id('f18b4bef-212e-45e7-b3ca-59af3a465f82') @utils.requires_ext(extension='staticweb', service='object') def test_web_error(self): + """Test web error""" headers = {'web-listings': 'true', 'web-error': self.object_name} diff --git a/tempest/api/object_storage/test_object_formpost.py b/tempest/api/object_storage/test_object_formpost.py index cd834bf488..d857d3b12f 100644 --- a/tempest/api/object_storage/test_object_formpost.py +++ b/tempest/api/object_storage/test_object_formpost.py @@ -25,6 +25,7 @@ from tempest.lib import decorators class ObjectFormPostTest(base.BaseObjectTest): + """Test object post with form""" metadata = {} containers = [] @@ -110,6 +111,7 @@ class ObjectFormPostTest(base.BaseObjectTest): @decorators.idempotent_id('80fac02b-6e54-4f7b-be0d-a965b5cbef76') @utils.requires_ext(extension='formpost', service='object') def test_post_object_using_form(self): + """Test posting object using form""" body, content_type = self.get_multipart_form() headers = {'Content-Type': content_type, diff --git a/tempest/api/object_storage/test_object_formpost_negative.py b/tempest/api/object_storage/test_object_formpost_negative.py index df6a0fda48..0499eef270 100644 --- a/tempest/api/object_storage/test_object_formpost_negative.py +++ b/tempest/api/object_storage/test_object_formpost_negative.py @@ -26,6 +26,7 @@ from tempest.lib import exceptions as lib_exc class ObjectFormPostNegativeTest(base.BaseObjectTest): + """Negative tests of object post with form""" metadata = {} containers = [] @@ -112,6 +113,7 @@ class ObjectFormPostNegativeTest(base.BaseObjectTest): @utils.requires_ext(extension='formpost', service='object') @decorators.attr(type=['negative']) def test_post_object_using_form_expired(self): + """Test posting object using expired form""" body, content_type = self.get_multipart_form(expires=1) time.sleep(2) @@ -129,6 +131,7 @@ class ObjectFormPostNegativeTest(base.BaseObjectTest): @utils.requires_ext(extension='formpost', service='object') @decorators.attr(type=['negative']) def test_post_object_using_form_invalid_signature(self): + """Test posting object using form with invalid signature""" self.key = "Wrong" body, content_type = self.get_multipart_form() diff --git a/tempest/api/object_storage/test_object_temp_url.py b/tempest/api/object_storage/test_object_temp_url.py index b99f93a40c..29354b62c1 100644 --- a/tempest/api/object_storage/test_object_temp_url.py +++ b/tempest/api/object_storage/test_object_temp_url.py @@ -25,6 +25,7 @@ from tempest.lib import decorators class ObjectTempUrlTest(base.BaseObjectTest): + """Test object temp url""" @classmethod def resource_setup(cls): @@ -90,6 +91,7 @@ class ObjectTempUrlTest(base.BaseObjectTest): @decorators.idempotent_id('f91c96d4-1230-4bba-8eb9-84476d18d991') @utils.requires_ext(extension='tempurl', service='object') def test_get_object_using_temp_url(self): + """Test getting object using temp url""" expires = self._get_expiry_date() # get a temp URL for the created object @@ -109,6 +111,7 @@ class ObjectTempUrlTest(base.BaseObjectTest): @decorators.idempotent_id('671f9583-86bd-4128-a034-be282a68c5d8') @utils.requires_ext(extension='tempurl', service='object') def test_get_object_using_temp_url_key_2(self): + """Test getting object using metadata 'Temp-URL-Key-2'""" key2 = 'Meta2-' metadata = {'Temp-URL-Key-2': key2} self.account_client.create_update_or_delete_account_metadata( @@ -134,6 +137,7 @@ class ObjectTempUrlTest(base.BaseObjectTest): @decorators.idempotent_id('9b08dade-3571-4152-8a4f-a4f2a873a735') @utils.requires_ext(extension='tempurl', service='object') def test_put_object_using_temp_url(self): + """Test putting object using temp url""" new_data = data_utils.random_bytes(size=len(self.object_name)) expires = self._get_expiry_date() @@ -160,6 +164,7 @@ class ObjectTempUrlTest(base.BaseObjectTest): @decorators.idempotent_id('249a0111-5ad3-4534-86a7-1993d55f9185') @utils.requires_ext(extension='tempurl', service='object') def test_head_object_using_temp_url(self): + """Test HEAD operation of object using temp url""" expires = self._get_expiry_date() # get a temp URL for the created object @@ -174,6 +179,7 @@ class ObjectTempUrlTest(base.BaseObjectTest): @decorators.idempotent_id('9d9cfd90-708b-465d-802c-e4a8090b823d') @utils.requires_ext(extension='tempurl', service='object') def test_get_object_using_temp_url_with_inline_query_parameter(self): + """Test getting object using temp url with inline query parameter""" expires = self._get_expiry_date() # get a temp URL for the created object diff --git a/tempest/api/object_storage/test_object_temp_url_negative.py b/tempest/api/object_storage/test_object_temp_url_negative.py index 17ae6c10bd..bbb48272b5 100644 --- a/tempest/api/object_storage/test_object_temp_url_negative.py +++ b/tempest/api/object_storage/test_object_temp_url_negative.py @@ -26,6 +26,7 @@ from tempest.lib import exceptions as lib_exc class ObjectTempUrlNegativeTest(base.BaseObjectTest): + """Negative tests of object temp url""" metadata = {} containers = [] @@ -96,7 +97,7 @@ class ObjectTempUrlNegativeTest(base.BaseObjectTest): @decorators.idempotent_id('5a583aca-c804-41ba-9d9a-e7be132bdf0b') @utils.requires_ext(extension='tempurl', service='object') def test_get_object_after_expiration_time(self): - + """Test getting object after expiration time""" expires = self._get_expiry_date(1) # get a temp URL for the created object url = self._get_temp_url(self.container_name,