Remove unused variables from api tests
Change-Id: I22051000745d2d339f6bcf4544e7a01f4c217d8a
This commit is contained in:
parent
5aad8e753a
commit
e52bee7ea5
@ -143,7 +143,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@decorators.idempotent_id('99b297f6-2b5d-47c7-97a9-8b6bb4f91042')
|
||||
def test_assign_user_role_for_non_existent_role(self):
|
||||
# Attempt to assign a non existent role to user should fail
|
||||
(user, tenant, role) = self._get_role_params()
|
||||
(user, tenant, _) = self._get_role_params()
|
||||
non_existent_role = data_utils.rand_uuid_hex()
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
self.roles_client.create_user_role_on_project,
|
||||
@ -153,7 +153,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@decorators.idempotent_id('b2285aaa-9e76-4704-93a9-7a8acd0a6c8f')
|
||||
def test_assign_user_role_for_non_existent_tenant(self):
|
||||
# Attempt to assign a role on a non existent tenant should fail
|
||||
(user, tenant, role) = self._get_role_params()
|
||||
(user, _, role) = self._get_role_params()
|
||||
non_existent_tenant = data_utils.rand_uuid_hex()
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
self.roles_client.create_user_role_on_project,
|
||||
@ -244,7 +244,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
|
||||
@decorators.idempotent_id('682adfb2-fd5f-4b0a-a9ca-322e9bebb907')
|
||||
def test_list_user_roles_request_without_token(self):
|
||||
# Request to list user's roles without a valid token should fail
|
||||
(user, tenant, role) = self._get_role_params()
|
||||
(user, tenant, _) = self._get_role_params()
|
||||
token = self.client.auth_provider.get_token()
|
||||
self.client.delete_token(token)
|
||||
try:
|
||||
|
@ -79,7 +79,7 @@ class TestDefaultProjectId (base.BaseIdentityV3AdminTest):
|
||||
admin_client = clients.Manager(credentials=creds)
|
||||
|
||||
# verify the user's token and see that it is scoped to the project
|
||||
token, auth_data = admin_client.auth_provider.get_auth()
|
||||
token, _ = admin_client.auth_provider.get_auth()
|
||||
result = admin_client.identity_v3_client.show_token(token)['token']
|
||||
self.assertEqual(result['project']['domain']['id'], dom_id)
|
||||
self.assertEqual(result['project']['id'], proj_id)
|
||||
|
@ -83,7 +83,7 @@ class SecGroupTest(base.BaseSecGroupTest):
|
||||
@decorators.attr(type='smoke')
|
||||
@decorators.idempotent_id('bfd128e5-3c92-44b6-9d66-7fe29d22c802')
|
||||
def test_create_list_update_show_delete_security_group(self):
|
||||
group_create_body, name = self._create_security_group()
|
||||
group_create_body, _ = self._create_security_group()
|
||||
|
||||
# List security groups and verify if created group is there in response
|
||||
list_body = self.security_groups_client.list_security_groups()
|
||||
|
@ -43,8 +43,7 @@ def delete_containers(containers, container_client, object_client):
|
||||
for cont in containers:
|
||||
try:
|
||||
params = {'limit': 9999, 'format': 'json'}
|
||||
resp, objlist = container_client.list_container_contents(
|
||||
cont, params)
|
||||
_, objlist = container_client.list_container_contents(cont, params)
|
||||
# delete every object in the container
|
||||
for obj in objlist:
|
||||
test_utils.call_and_ignore_notfound_exc(
|
||||
|
@ -112,7 +112,7 @@ class BulkTest(base.BaseObjectTest):
|
||||
self._upload_archive(filepath)
|
||||
|
||||
data = '%s/%s\n%s' % (container_name, object_name, container_name)
|
||||
resp, body = self.bulk_client.delete_bulk_data(data=data)
|
||||
resp, _ = self.bulk_client.delete_bulk_data(data=data)
|
||||
|
||||
# When deleting multiple files using the bulk operation, the response
|
||||
# does not contain 'content-length' header. This is the special case,
|
||||
@ -138,7 +138,7 @@ class BulkTest(base.BaseObjectTest):
|
||||
|
||||
data = '%s/%s\n%s' % (container_name, object_name, container_name)
|
||||
|
||||
resp, body = self.bulk_client.delete_bulk_data_with_post(data=data)
|
||||
resp, _ = self.bulk_client.delete_bulk_data_with_post(data=data)
|
||||
|
||||
# When deleting multiple files using the bulk operation, the response
|
||||
# does not contain 'content-length' header. This is the special case,
|
||||
|
@ -135,7 +135,7 @@ class AccountTest(base.BaseObjectTest):
|
||||
not CONF.object_storage_feature_enabled.discoverability,
|
||||
'Discoverability function is disabled')
|
||||
def test_list_extensions(self):
|
||||
resp, extensions = self.capabilities_client.list_capabilities()
|
||||
resp, _ = self.capabilities_client.list_capabilities()
|
||||
|
||||
self.assertThat(resp, custom_matchers.AreAllWellFormatted())
|
||||
|
||||
@ -297,7 +297,7 @@ class AccountTest(base.BaseObjectTest):
|
||||
create_update_metadata=metadata)
|
||||
self.assertHeaders(resp, 'Account', 'POST')
|
||||
|
||||
resp, body = self.account_client.list_account_metadata()
|
||||
resp, _ = self.account_client.list_account_metadata()
|
||||
self.assertIn('x-account-meta-test-account-meta1', resp)
|
||||
self.assertEqual(resp['x-account-meta-test-account-meta1'],
|
||||
metadata['test-account-meta1'])
|
||||
@ -352,7 +352,7 @@ class AccountTest(base.BaseObjectTest):
|
||||
self.account_client.create_update_or_delete_account_metadata(
|
||||
create_update_metadata=metadata_1)
|
||||
metadata_2 = {'test-account-meta2': 'Meta2'}
|
||||
resp, body = (
|
||||
resp, _ = (
|
||||
self.account_client.create_update_or_delete_account_metadata(
|
||||
create_update_metadata=metadata_2,
|
||||
delete_metadata=metadata_1))
|
||||
|
@ -41,10 +41,10 @@ class ObjectTestACLs(base.BaseObjectTest):
|
||||
tenant_name = self.os_roles_operator_alt.credentials.tenant_name
|
||||
username = self.os_roles_operator_alt.credentials.username
|
||||
cont_headers = {'X-Container-Read': tenant_name + ':' + username}
|
||||
resp_meta, body = self.os_roles_operator.container_client.\
|
||||
update_container_metadata(
|
||||
resp_meta, _ = (
|
||||
self.os_roles_operator.container_client.update_container_metadata(
|
||||
self.container_name, metadata=cont_headers,
|
||||
metadata_prefix='')
|
||||
metadata_prefix=''))
|
||||
self.assertHeaders(resp_meta, 'Container', 'POST')
|
||||
# create object
|
||||
object_name = data_utils.rand_name(name='Object')
|
||||
@ -68,10 +68,10 @@ class ObjectTestACLs(base.BaseObjectTest):
|
||||
tenant_name = self.os_roles_operator_alt.credentials.tenant_name
|
||||
username = self.os_roles_operator_alt.credentials.username
|
||||
cont_headers = {'X-Container-Write': tenant_name + ':' + username}
|
||||
resp_meta, body = self.os_roles_operator.container_client.\
|
||||
update_container_metadata(self.container_name,
|
||||
metadata=cont_headers,
|
||||
metadata_prefix='')
|
||||
resp_meta, _ = (
|
||||
self.os_roles_operator.container_client.update_container_metadata(
|
||||
self.container_name, metadata=cont_headers,
|
||||
metadata_prefix=''))
|
||||
self.assertHeaders(resp_meta, 'Container', 'POST')
|
||||
# set alternative authentication data; cannot simply use the
|
||||
# other object client.
|
||||
|
@ -65,8 +65,8 @@ class ObjectACLsNegativeTest(base.BaseObjectTest):
|
||||
def test_delete_object_without_using_creds(self):
|
||||
# create object
|
||||
object_name = data_utils.rand_name(name='Object')
|
||||
resp, _ = self.object_client.create_object(self.container_name,
|
||||
object_name, 'data')
|
||||
self.object_client.create_object(self.container_name, object_name,
|
||||
'data')
|
||||
# trying to delete object with empty headers
|
||||
# X-Auth-Token is not provided
|
||||
self.object_client.auth_provider.set_alt_auth_data(
|
||||
@ -134,7 +134,7 @@ class ObjectACLsNegativeTest(base.BaseObjectTest):
|
||||
# attempt to read object using non-authorized user
|
||||
# update X-Container-Read metadata ACL
|
||||
cont_headers = {'X-Container-Read': 'badtenant:baduser'}
|
||||
resp_meta, body = self.container_client.update_container_metadata(
|
||||
resp_meta, _ = self.container_client.update_container_metadata(
|
||||
self.container_name, metadata=cont_headers,
|
||||
metadata_prefix='')
|
||||
self.assertHeaders(resp_meta, 'Container', 'POST')
|
||||
@ -158,7 +158,7 @@ class ObjectACLsNegativeTest(base.BaseObjectTest):
|
||||
# attempt to write object using non-authorized user
|
||||
# update X-Container-Write metadata ACL
|
||||
cont_headers = {'X-Container-Write': 'badtenant:baduser'}
|
||||
resp_meta, body = self.container_client.update_container_metadata(
|
||||
resp_meta, _ = self.container_client.update_container_metadata(
|
||||
self.container_name, metadata=cont_headers,
|
||||
metadata_prefix='')
|
||||
self.assertHeaders(resp_meta, 'Container', 'POST')
|
||||
@ -183,7 +183,7 @@ class ObjectACLsNegativeTest(base.BaseObjectTest):
|
||||
cont_headers = {'X-Container-Read':
|
||||
tenant_name + ':' + username,
|
||||
'X-Container-Write': ''}
|
||||
resp_meta, body = self.container_client.update_container_metadata(
|
||||
resp_meta, _ = self.container_client.update_container_metadata(
|
||||
self.container_name, metadata=cont_headers,
|
||||
metadata_prefix='')
|
||||
self.assertHeaders(resp_meta, 'Container', 'POST')
|
||||
@ -208,7 +208,7 @@ class ObjectACLsNegativeTest(base.BaseObjectTest):
|
||||
cont_headers = {'X-Container-Read':
|
||||
tenant_name + ':' + username,
|
||||
'X-Container-Write': ''}
|
||||
resp_meta, body = self.container_client.update_container_metadata(
|
||||
resp_meta, _ = self.container_client.update_container_metadata(
|
||||
self.container_name, metadata=cont_headers,
|
||||
metadata_prefix='')
|
||||
self.assertHeaders(resp_meta, 'Container', 'POST')
|
||||
|
@ -27,7 +27,7 @@ class ContainerTest(base.BaseObjectTest):
|
||||
@decorators.idempotent_id('92139d73-7819-4db1-85f8-3f2f22a8d91f')
|
||||
def test_create_container(self):
|
||||
container_name = data_utils.rand_name(name='TestContainer')
|
||||
resp, body = self.container_client.create_container(container_name)
|
||||
resp, _ = self.container_client.create_container(container_name)
|
||||
self.containers.append(container_name)
|
||||
self.assertHeaders(resp, 'Container', 'PUT')
|
||||
|
||||
|
@ -124,9 +124,8 @@ class StaticWebTest(base.BaseObjectTest):
|
||||
|
||||
# test GET on http://account_url/container_name
|
||||
# we should retrieve a listing of objects
|
||||
resp, body = self.account_client.request("GET",
|
||||
self.container_name,
|
||||
headers={})
|
||||
_, body = self.account_client.request("GET", self.container_name,
|
||||
headers={})
|
||||
self.assertIn(self.object_name, body.decode())
|
||||
css = '<link rel="stylesheet" type="text/css" href="listings.css" />'
|
||||
self.assertIn(css, body.decode())
|
||||
|
@ -90,8 +90,7 @@ class ContainerSyncTest(base.BaseObjectTest):
|
||||
cont_client = [self.clients[c][0] for c in cont]
|
||||
obj_client = [self.clients[c][1] for c in cont]
|
||||
headers = make_headers(cont[1], cont_client[1])
|
||||
resp, body = \
|
||||
cont_client[0].put(str(cont[0]), body=None, headers=headers)
|
||||
cont_client[0].put(str(cont[0]), body=None, headers=headers)
|
||||
# create object in container
|
||||
object_name = data_utils.rand_name(name='TestSyncObject')
|
||||
data = object_name[::-1].encode() # Raw data, we need bytes
|
||||
|
@ -54,8 +54,8 @@ class ObjectExpiryTest(base.BaseObjectTest):
|
||||
# actually expire, so figure out how many secs in the future that is.
|
||||
sleepy_time = int(resp['x-delete-at']) - int(time.time())
|
||||
sleepy_time = sleepy_time if sleepy_time > 0 else 0
|
||||
resp, body = self.object_client.get_object(self.container_name,
|
||||
self.object_name)
|
||||
resp, _ = self.object_client.get_object(self.container_name,
|
||||
self.object_name)
|
||||
self.assertHeaders(resp, 'Object', 'GET')
|
||||
self.assertIn('x-delete-at', resp)
|
||||
|
||||
|
@ -48,7 +48,7 @@ class ObjectTest(base.BaseObjectTest):
|
||||
data_segments = [data + str(i) for i in range(segments)]
|
||||
# uploading segments
|
||||
for i in range(segments):
|
||||
resp, _ = self.object_client.create_object_segments(
|
||||
self.object_client.create_object_segments(
|
||||
self.container_name, object_name, i, data_segments[i])
|
||||
|
||||
return object_name, data_segments
|
||||
@ -184,7 +184,7 @@ class ObjectTest(base.BaseObjectTest):
|
||||
# create object with transfer_encoding
|
||||
object_name = data_utils.rand_name(name='TestObject')
|
||||
data = data_utils.random_bytes(1024)
|
||||
status, _, resp_headers = self.object_client.put_object_with_chunk(
|
||||
_, _, resp_headers = self.object_client.put_object_with_chunk(
|
||||
container=self.container_name,
|
||||
name=object_name,
|
||||
contents=data_utils.chunkify(data, 512)
|
||||
@ -394,7 +394,7 @@ class ObjectTest(base.BaseObjectTest):
|
||||
# update object metadata with x_object_manifest
|
||||
|
||||
# uploading segments
|
||||
object_name, data_segments = self._upload_segments()
|
||||
object_name, _ = self._upload_segments()
|
||||
# creating a manifest file
|
||||
data_empty = ''
|
||||
self.object_client.create_object(self.container_name,
|
||||
@ -494,7 +494,7 @@ class ObjectTest(base.BaseObjectTest):
|
||||
# get object metadata with x_object_manifest
|
||||
|
||||
# uploading segments
|
||||
object_name, data_segments = self._upload_segments()
|
||||
object_name, _ = self._upload_segments()
|
||||
# creating a manifest file
|
||||
object_prefix = '%s/%s' % (self.container_name, object_name)
|
||||
metadata = {'X-Object-Manifest': object_prefix}
|
||||
@ -520,7 +520,7 @@ class ObjectTest(base.BaseObjectTest):
|
||||
self.assertTrue(resp['etag'].startswith('\"'))
|
||||
self.assertTrue(resp['etag'].endswith('\"'))
|
||||
self.assertTrue(resp['etag'].strip('\"').isalnum())
|
||||
self.assertTrue(re.match("^\d+\.?\d*\Z", resp['x-timestamp']))
|
||||
self.assertTrue(re.match(r"^\d+\.?\d*\Z", resp['x-timestamp']))
|
||||
self.assertNotEmpty(resp['content-type'])
|
||||
self.assertTrue(re.match("^tx[0-9a-f]{21}-[0-9a-f]{10}.*",
|
||||
resp['x-trans-id']))
|
||||
@ -612,7 +612,7 @@ class ObjectTest(base.BaseObjectTest):
|
||||
self.assertTrue(resp['etag'].startswith('\"'))
|
||||
self.assertTrue(resp['etag'].endswith('\"'))
|
||||
self.assertTrue(resp['etag'].strip('\"').isalnum())
|
||||
self.assertTrue(re.match("^\d+\.?\d*\Z", resp['x-timestamp']))
|
||||
self.assertTrue(re.match(r"^\d+\.?\d*\Z", resp['x-timestamp']))
|
||||
self.assertNotEmpty(resp['content-type'])
|
||||
self.assertTrue(re.match("^tx[0-9a-f]{21}-[0-9a-f]{10}.*",
|
||||
resp['x-trans-id']))
|
||||
@ -955,7 +955,7 @@ class ObjectTest(base.BaseObjectTest):
|
||||
local_data = "something different"
|
||||
md5 = hashlib.md5(local_data.encode()).hexdigest()
|
||||
headers = {'If-None-Match': md5}
|
||||
resp, body = self.object_client.get(url, headers=headers)
|
||||
resp, _ = self.object_client.get(url, headers=headers)
|
||||
self.assertHeaders(resp, 'Object', 'GET')
|
||||
|
||||
|
||||
|
@ -127,7 +127,7 @@ class ObjectSloTest(base.BaseObjectTest):
|
||||
# list static large object metadata using multipart manifest
|
||||
object_name = self._create_large_object()
|
||||
|
||||
resp, body = self.object_client.list_object_metadata(
|
||||
resp, _ = self.object_client.list_object_metadata(
|
||||
self.container_name,
|
||||
object_name)
|
||||
|
||||
@ -155,7 +155,7 @@ class ObjectSloTest(base.BaseObjectTest):
|
||||
object_name = self._create_large_object()
|
||||
|
||||
params_del = {'multipart-manifest': 'delete'}
|
||||
resp, body = self.object_client.delete_object(
|
||||
resp, _ = self.object_client.delete_object(
|
||||
self.container_name,
|
||||
object_name,
|
||||
params=params_del)
|
||||
|
@ -128,7 +128,7 @@ class ObjectTempUrlTest(base.BaseObjectTest):
|
||||
url = self._get_temp_url(self.container_name,
|
||||
self.object_name, "GET",
|
||||
expires, key2)
|
||||
resp, body = self.object_client.get(url)
|
||||
_, body = self.object_client.get(url)
|
||||
self.assertEqual(body, self.content)
|
||||
|
||||
@decorators.idempotent_id('9b08dade-3571-4152-8a4f-a4f2a873a735')
|
||||
@ -168,7 +168,7 @@ class ObjectTempUrlTest(base.BaseObjectTest):
|
||||
expires, self.key)
|
||||
|
||||
# Testing a HEAD on this Temp URL
|
||||
resp, body = self.object_client.head(url)
|
||||
resp, _ = self.object_client.head(url)
|
||||
self.assertHeaders(resp, 'Object', 'HEAD')
|
||||
|
||||
@decorators.idempotent_id('9d9cfd90-708b-465d-802c-e4a8090b823d')
|
||||
|
@ -46,7 +46,7 @@ class ObjectTempUrlNegativeTest(base.BaseObjectTest):
|
||||
|
||||
@classmethod
|
||||
def resource_cleanup(cls):
|
||||
resp, _ = cls.account_client.create_update_or_delete_account_metadata(
|
||||
cls.account_client.create_update_or_delete_account_metadata(
|
||||
delete_metadata=cls.metadata)
|
||||
|
||||
cls.delete_containers()
|
||||
|
Loading…
Reference in New Issue
Block a user