Enable H302 rule everywhere

This patch enables the use of the H302 hacking rule everywhere. With
one exception of the client class imports in clients.py, this
is intentionally ignored.

Change-Id: Ia0ef5e44a411ccd6e6c12f9cf64427a96e021b47
This commit is contained in:
Matthew Treinish 2014-05-18 21:14:36 -04:00
parent 2b6db0c641
commit 5c660abe58
37 changed files with 247 additions and 247 deletions

View File

@ -15,7 +15,7 @@
from tempest.api.compute import base
from tempest import exceptions
from tempest.test import attr
from tempest import test
class AZAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
@ -30,7 +30,7 @@ class AZAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
cls.client = cls.availability_zone_admin_client
cls.non_adm_client = cls.availability_zone_client
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_get_availability_zone_list_detail_with_non_admin_user(self):
# List of availability zones and available services with
# non-administrator user

View File

@ -14,7 +14,7 @@
# under the License.
from tempest.api.compute import base
from tempest.test import attr
from tempest import test
class HypervisorAdminV3Test(base.BaseV3ComputeAdminTest):
@ -34,20 +34,20 @@ class HypervisorAdminV3Test(base.BaseV3ComputeAdminTest):
self.assertEqual(200, resp.status)
return hypers
@attr(type='gate')
@test.attr(type='gate')
def test_get_hypervisor_list(self):
# List of hypervisor and available hypervisors hostname
hypers = self._list_hypervisors()
self.assertTrue(len(hypers) > 0)
@attr(type='gate')
@test.attr(type='gate')
def test_get_hypervisor_list_details(self):
# Display the details of the all hypervisor
resp, hypers = self.client.get_hypervisor_list_details()
self.assertEqual(200, resp.status)
self.assertTrue(len(hypers) > 0)
@attr(type='gate')
@test.attr(type='gate')
def test_get_hypervisor_show_details(self):
# Display the details of the specified hypervisor
hypers = self._list_hypervisors()
@ -60,7 +60,7 @@ class HypervisorAdminV3Test(base.BaseV3ComputeAdminTest):
self.assertEqual(details['hypervisor_hostname'],
hypers[0]['hypervisor_hostname'])
@attr(type='gate')
@test.attr(type='gate')
def test_get_hypervisor_show_servers(self):
# Show instances about the specific hypervisors
hypers = self._list_hypervisors()
@ -71,14 +71,14 @@ class HypervisorAdminV3Test(base.BaseV3ComputeAdminTest):
self.assertEqual(200, resp.status)
self.assertTrue(len(hypervisors) > 0)
@attr(type='gate')
@test.attr(type='gate')
def test_get_hypervisor_stats(self):
# Verify the stats of the all hypervisor
resp, stats = self.client.get_hypervisor_stats()
self.assertEqual(200, resp.status)
self.assertTrue(len(stats) > 0)
@attr(type='gate')
@test.attr(type='gate')
def test_get_hypervisor_uptime(self):
# Verify that GET shows the specified hypervisor uptime
hypers = self._list_hypervisors()
@ -87,7 +87,7 @@ class HypervisorAdminV3Test(base.BaseV3ComputeAdminTest):
self.assertEqual(200, resp.status)
self.assertTrue(len(uptime) > 0)
@attr(type='gate')
@test.attr(type='gate')
def test_search_hypervisor(self):
hypers = self._list_hypervisors()
self.assertTrue(len(hypers) > 0)

View File

@ -18,7 +18,7 @@ import uuid
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest import test
class HypervisorAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
@ -39,7 +39,7 @@ class HypervisorAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
self.assertEqual(200, resp.status)
return hypers
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_show_nonexistent_hypervisor(self):
nonexistent_hypervisor_id = str(uuid.uuid4())
@ -48,7 +48,7 @@ class HypervisorAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
self.client.get_hypervisor_show_details,
nonexistent_hypervisor_id)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_show_hypervisor_with_non_admin_user(self):
hypers = self._list_hypervisors()
self.assertTrue(len(hypers) > 0)
@ -58,7 +58,7 @@ class HypervisorAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
self.non_adm_client.get_hypervisor_show_details,
hypers[0]['id'])
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_show_servers_with_non_admin_user(self):
hypers = self._list_hypervisors()
self.assertTrue(len(hypers) > 0)
@ -68,7 +68,7 @@ class HypervisorAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
self.non_adm_client.get_hypervisor_servers,
hypers[0]['id'])
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_show_servers_with_nonexistent_hypervisor(self):
nonexistent_hypervisor_id = str(uuid.uuid4())
@ -77,13 +77,13 @@ class HypervisorAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
self.client.get_hypervisor_servers,
nonexistent_hypervisor_id)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_get_hypervisor_stats_with_non_admin_user(self):
self.assertRaises(
exceptions.Unauthorized,
self.non_adm_client.get_hypervisor_stats)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_get_nonexistent_hypervisor_uptime(self):
nonexistent_hypervisor_id = str(uuid.uuid4())
@ -92,7 +92,7 @@ class HypervisorAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
self.client.get_hypervisor_uptime,
nonexistent_hypervisor_id)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_get_hypervisor_uptime_with_non_admin_user(self):
hypers = self._list_hypervisors()
self.assertTrue(len(hypers) > 0)
@ -102,21 +102,21 @@ class HypervisorAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
self.non_adm_client.get_hypervisor_uptime,
hypers[0]['id'])
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_get_hypervisor_list_with_non_admin_user(self):
# List of hypervisor and available services with non admin user
self.assertRaises(
exceptions.Unauthorized,
self.non_adm_client.get_hypervisor_list)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_get_hypervisor_list_details_with_non_admin_user(self):
# List of hypervisor details and available services with non admin user
self.assertRaises(
exceptions.Unauthorized,
self.non_adm_client.get_hypervisor_list_details)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_search_nonexistent_hypervisor(self):
nonexistent_hypervisor_name = data_utils.rand_name('test_hypervisor')
@ -125,7 +125,7 @@ class HypervisorAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
self.assertEqual(200, resp.status)
self.assertEqual(0, len(hypers))
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_search_hypervisor_with_non_admin_user(self):
hypers = self._list_hypervisors()
self.assertTrue(len(hypers) > 0)

View File

@ -20,7 +20,7 @@ from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
from tempest.test import attr
from tempest import test
CONF = config.CONF
@ -54,7 +54,7 @@ class ServersAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
flavor_id = data_utils.rand_int_id(start=1000)
return flavor_id
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_resize_server_using_overlimit_ram(self):
flavor_name = data_utils.rand_name("flavor-")
flavor_id = self._get_unused_flavor_id()
@ -72,7 +72,7 @@ class ServersAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
self.servers[0]['id'],
flavor_ref['id'])
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_resize_server_using_overlimit_vcpus(self):
flavor_name = data_utils.rand_name("flavor-")
flavor_id = self._get_unused_flavor_id()
@ -90,31 +90,31 @@ class ServersAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
self.servers[0]['id'],
flavor_ref['id'])
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_reset_state_server_invalid_state(self):
self.assertRaises(exceptions.BadRequest,
self.client.reset_state, self.s1_id,
state='invalid')
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_reset_state_server_invalid_type(self):
self.assertRaises(exceptions.BadRequest,
self.client.reset_state, self.s1_id,
state=1)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_reset_state_server_nonexistent_server(self):
self.assertRaises(exceptions.NotFound,
self.client.reset_state, '999')
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_get_server_diagnostics_by_non_admin(self):
# Non-admin user can not view server diagnostics according to policy
self.assertRaises(exceptions.Unauthorized,
self.non_adm_client.get_server_diagnostics,
self.s1_id)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_migrate_non_existent_server(self):
# migrate a non existent server
self.assertRaises(exceptions.NotFound,
@ -123,7 +123,7 @@ class ServersAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
@testtools.skipUnless(CONF.compute_feature_enabled.suspend,
'Suspend is not available.')
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_migrate_server_invalid_state(self):
# create server.
resp, server = self.create_test_server(wait_until='ACTIVE')

View File

@ -15,7 +15,7 @@
# under the License.
from tempest.api.compute import base
from tempest.test import attr
from tempest import test
class ServicesAdminV3Test(base.BaseV3ComputeAdminTest):
@ -29,13 +29,13 @@ class ServicesAdminV3Test(base.BaseV3ComputeAdminTest):
super(ServicesAdminV3Test, cls).setUpClass()
cls.client = cls.services_admin_client
@attr(type='gate')
@test.attr(type='gate')
def test_list_services(self):
resp, services = self.client.list_services()
self.assertEqual(200, resp.status)
self.assertNotEqual(0, len(services))
@attr(type='gate')
@test.attr(type='gate')
def test_get_service_by_service_binary_name(self):
binary_name = 'nova-compute'
params = {'binary': binary_name}
@ -45,7 +45,7 @@ class ServicesAdminV3Test(base.BaseV3ComputeAdminTest):
for service in services:
self.assertEqual(binary_name, service['binary'])
@attr(type='gate')
@test.attr(type='gate')
def test_get_service_by_host_name(self):
resp, services = self.client.list_services()
self.assertEqual(200, resp.status)
@ -65,7 +65,7 @@ class ServicesAdminV3Test(base.BaseV3ComputeAdminTest):
# on order.
self.assertEqual(sorted(s1), sorted(s2))
@attr(type='gate')
@test.attr(type='gate')
def test_get_service_by_service_and_host_name(self):
resp, services = self.client.list_services()
host_name = services[0]['host']

View File

@ -16,7 +16,7 @@
from tempest.api.compute import base
from tempest import exceptions
from tempest.test import attr
from tempest import test
class ServicesAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
@ -31,12 +31,12 @@ class ServicesAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
cls.client = cls.services_admin_client
cls.non_admin_client = cls.services_client
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_list_services_with_non_admin_user(self):
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.list_services)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_get_service_by_invalid_params(self):
# return all services if send the request with invalid parameter
resp, services = self.client.list_services()
@ -45,7 +45,7 @@ class ServicesAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
self.assertEqual(200, resp.status)
self.assertEqual(len(services), len(services_xxx))
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_get_service_by_invalid_service_and_valid_host(self):
resp, services = self.client.list_services()
host_name = services[0]['host']
@ -54,7 +54,7 @@ class ServicesAdminNegativeV3Test(base.BaseV3ComputeAdminTest):
self.assertEqual(200, resp.status)
self.assertEqual(0, len(services))
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_get_service_with_valid_service_and_invalid_host(self):
resp, services = self.client.list_services()
binary_name = services[0]['binary']

View File

@ -16,7 +16,7 @@
from tempest.api.compute import base
from tempest import config
from tempest import exceptions
from tempest.test import attr
from tempest import test
import time
@ -106,7 +106,7 @@ class AttachInterfacesV3Test(base.BaseV3ComputeTest):
self.assertEqual(sorted(list1), sorted(list2))
@attr(type='smoke')
@test.attr(type='smoke')
def test_create_list_show_delete_interfaces(self):
server, ifs = self._create_server_get_interfaces()
interface_count = len(ifs)
@ -127,7 +127,7 @@ class AttachInterfacesV3Test(base.BaseV3ComputeTest):
_ifs = self._test_delete_interface(server, ifs)
self.assertEqual(len(ifs) - 1, len(_ifs))
@attr(type='smoke')
@test.attr(type='smoke')
def test_add_remove_fixed_ip(self):
# Add and Remove the fixed IP to server.
server, ifs = self._create_server_get_interfaces()

View File

@ -17,7 +17,7 @@ import testtools
from tempest.api.compute import base
from tempest import config
from tempest.test import attr
from tempest import test
CONF = config.CONF
@ -85,7 +85,7 @@ class LiveBlockMigrationV3Test(base.BaseV3ComputeAdminTest):
@testtools.skipIf(not CONF.compute_feature_enabled.live_migration,
'Live migration not available')
@attr(type='gate')
@test.attr(type='gate')
def test_live_block_migration(self):
# Live block migrate an instance to another host
if len(self._get_compute_hostnames()) < 2:
@ -105,7 +105,7 @@ class LiveBlockMigrationV3Test(base.BaseV3ComputeAdminTest):
@testtools.skipIf(not CONF.compute_feature_enabled.
block_migrate_cinder_iscsi,
'Block Live migration not configured for iSCSI')
@attr(type='gate')
@test.attr(type='gate')
def test_iscsi_volume(self):
# Live block migrate an instance to another host
if len(self._get_compute_hostnames()) < 2:

View File

@ -16,7 +16,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
from tempest.test import attr
from tempest import test
CONF = config.CONF
@ -75,7 +75,7 @@ class VolumesTestJSON(base.BaseV2ComputeTest):
cls.delete_volume(volume['id'])
super(VolumesTestJSON, cls).tearDownClass()
@attr(type='gate')
@test.attr(type='gate')
def test_volume_list(self):
# Should return the list of Volumes
# Fetch all Volumes
@ -91,7 +91,7 @@ class VolumesTestJSON(base.BaseV2ComputeTest):
', '.join(m_vol['displayName']
for m_vol in missing_volumes))
@attr(type='gate')
@test.attr(type='gate')
def test_volume_list_with_details(self):
# Should return the list of Volumes with details
# Fetch all Volumes
@ -107,7 +107,7 @@ class VolumesTestJSON(base.BaseV2ComputeTest):
', '.join(m_vol['displayName']
for m_vol in missing_volumes))
@attr(type='gate')
@test.attr(type='gate')
def test_volume_list_param_limit(self):
# Return the list of volumes based on limit set
params = {'limit': 2}
@ -117,7 +117,7 @@ class VolumesTestJSON(base.BaseV2ComputeTest):
self.assertEqual(len(fetched_vol_list), params['limit'],
"Failed to list volumes by limit set")
@attr(type='gate')
@test.attr(type='gate')
def test_volume_list_with_detail_param_limit(self):
# Return the list of volumes with details based on limit set.
params = {'limit': 2}
@ -128,7 +128,7 @@ class VolumesTestJSON(base.BaseV2ComputeTest):
self.assertEqual(len(fetched_vol_list), params['limit'],
"Failed to list volume details by limit set")
@attr(type='gate')
@test.attr(type='gate')
def test_volume_list_param_offset_and_limit(self):
# Return the list of volumes based on offset and limit set.
# get all volumes list
@ -146,7 +146,7 @@ class VolumesTestJSON(base.BaseV2ComputeTest):
all_vol_list[index + params['offset']]['id'],
"Failed to list volumes by offset and limit")
@attr(type='gate')
@test.attr(type='gate')
def test_volume_list_with_detail_param_offset_and_limit(self):
# Return the list of volumes details based on offset and limit set.
# get all volumes list

View File

@ -19,7 +19,7 @@ from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
from tempest.test import attr
from tempest import test
CONF = config.CONF
@ -34,7 +34,7 @@ class VolumesNegativeTest(base.BaseV2ComputeTest):
skip_msg = ("%s skipped as Cinder is not available" % cls.__name__)
raise cls.skipException(skip_msg)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_volume_get_nonexistent_volume_id(self):
# Negative: Should not be able to get details of nonexistent volume
# Creating a nonexistent volume id
@ -42,7 +42,7 @@ class VolumesNegativeTest(base.BaseV2ComputeTest):
self.assertRaises(exceptions.NotFound, self.client.get_volume,
str(uuid.uuid4()))
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_volume_delete_nonexistent_volume_id(self):
# Negative: Should not be able to delete nonexistent Volume
# Creating nonexistent volume id
@ -50,7 +50,7 @@ class VolumesNegativeTest(base.BaseV2ComputeTest):
self.assertRaises(exceptions.NotFound, self.client.delete_volume,
str(uuid.uuid4()))
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_volume_with_invalid_size(self):
# Negative: Should not be able to create volume with invalid size
# in request
@ -59,7 +59,7 @@ class VolumesNegativeTest(base.BaseV2ComputeTest):
self.assertRaises(exceptions.BadRequest, self.client.create_volume,
size='#$%', display_name=v_name, metadata=metadata)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_volume_with_out_passing_size(self):
# Negative: Should not be able to create volume without passing size
# in request
@ -68,7 +68,7 @@ class VolumesNegativeTest(base.BaseV2ComputeTest):
self.assertRaises(exceptions.BadRequest, self.client.create_volume,
size='', display_name=v_name, metadata=metadata)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_volume_with_size_zero(self):
# Negative: Should not be able to create volume with size zero
v_name = data_utils.rand_name('Volume-')
@ -76,25 +76,25 @@ class VolumesNegativeTest(base.BaseV2ComputeTest):
self.assertRaises(exceptions.BadRequest, self.client.create_volume,
size='0', display_name=v_name, metadata=metadata)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_get_invalid_volume_id(self):
# Negative: Should not be able to get volume with invalid id
self.assertRaises(exceptions.NotFound,
self.client.get_volume, '#$%%&^&^')
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_get_volume_without_passing_volume_id(self):
# Negative: Should not be able to get volume when empty ID is passed
self.assertRaises(exceptions.NotFound, self.client.get_volume, '')
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_delete_invalid_volume_id(self):
# Negative: Should not be able to delete volume when invalid ID is
# passed
self.assertRaises(exceptions.NotFound,
self.client.delete_volume, '!@#$%^&*()')
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_delete_volume_without_passing_volume_id(self):
# Negative: Should not be able to delete volume when empty ID is passed
self.assertRaises(exceptions.NotFound, self.client.delete_volume, '')

View File

@ -15,7 +15,7 @@
from tempest.api.data_processing import base as dp_base
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest import test
class NodeGroupTemplateTest(dp_base.BaseDataProcessingTest):
@ -61,7 +61,7 @@ class NodeGroupTemplateTest(dp_base.BaseDataProcessingTest):
return body['id'], template_name
@attr(type='smoke')
@test.attr(type='smoke')
def test_node_group_template_create(self):
template_name = data_utils.rand_name('sahara-ng-template')
resp, body = self.create_node_group_template(
@ -72,7 +72,7 @@ class NodeGroupTemplateTest(dp_base.BaseDataProcessingTest):
self.assertEqual(template_name, body['name'])
self.assertDictContainsSubset(self.node_group_template, body)
@attr(type='smoke')
@test.attr(type='smoke')
def test_node_group_template_list(self):
template_info = self._create_node_group_template()
@ -84,7 +84,7 @@ class NodeGroupTemplateTest(dp_base.BaseDataProcessingTest):
for template in templates]
self.assertIn(template_info, templates_info)
@attr(type='smoke')
@test.attr(type='smoke')
def test_node_group_template_get(self):
template_id, template_name = self._create_node_group_template()
@ -95,7 +95,7 @@ class NodeGroupTemplateTest(dp_base.BaseDataProcessingTest):
self.assertEqual(template_name, template['name'])
self.assertDictContainsSubset(self.node_group_template, template)
@attr(type='smoke')
@test.attr(type='smoke')
def test_node_group_template_delete(self):
template_id = self._create_node_group_template()[0]

View File

@ -14,7 +14,7 @@
# limitations under the License.
from tempest.api.data_processing import base as dp_base
from tempest.test import attr
from tempest import test
class PluginsTest(dp_base.BaseDataProcessingTest):
@ -33,11 +33,11 @@ class PluginsTest(dp_base.BaseDataProcessingTest):
return plugins_names
@attr(type='smoke')
@test.attr(type='smoke')
def test_plugin_list(self):
self._list_all_plugin_names()
@attr(type='smoke')
@test.attr(type='smoke')
def test_plugin_get(self):
for plugin_name in self._list_all_plugin_names():
resp, plugin = self.client.get_plugin(plugin_name)

View File

@ -18,7 +18,7 @@ import uuid
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest import test
class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
@ -32,13 +32,13 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
role = self.get_role_by_name(self.data.test_role)
return (user, tenant, role)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_list_roles_by_unauthorized_user(self):
# Non-administrator user should not be able to list roles
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.list_roles)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_list_roles_request_without_token(self):
# Request to list roles without a valid token should fail
token = self.client.auth_provider.get_token()
@ -46,19 +46,19 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.assertRaises(exceptions.Unauthorized, self.client.list_roles)
self.client.auth_provider.clear_auth()
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_role_create_blank_name(self):
# Should not be able to create a role with a blank name
self.assertRaises(exceptions.BadRequest, self.client.create_role, '')
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_role_by_unauthorized_user(self):
# Non-administrator user should not be able to create role
role_name = data_utils.rand_name(name='role-')
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.create_role, role_name)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_role_request_without_token(self):
# Request to create role without a valid token should fail
token = self.client.auth_provider.get_token()
@ -68,7 +68,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.client.create_role, role_name)
self.client.auth_provider.clear_auth()
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_role_create_duplicate(self):
# Role names should be unique
role_name = data_utils.rand_name(name='role-dup-')
@ -79,7 +79,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.assertRaises(exceptions.Conflict, self.client.create_role,
role_name)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_delete_role_by_unauthorized_user(self):
# Non-administrator user should not be able to delete role
role_name = data_utils.rand_name(name='role-')
@ -90,7 +90,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.delete_role, role_id)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_delete_role_request_without_token(self):
# Request to delete role without a valid token should fail
role_name = data_utils.rand_name(name='role-')
@ -105,14 +105,14 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
role_id)
self.client.auth_provider.clear_auth()
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_delete_role_non_existent(self):
# Attempt to delete a non existent role should fail
non_existent_role = str(uuid.uuid4().hex)
self.assertRaises(exceptions.NotFound, self.client.delete_role,
non_existent_role)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_assign_user_role_by_unauthorized_user(self):
# Non-administrator user should not be authorized to
# assign a role to user
@ -121,7 +121,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.non_admin_client.assign_user_role,
tenant['id'], user['id'], role['id'])
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_assign_user_role_request_without_token(self):
# Request to assign a role to a user without a valid token
(user, tenant, role) = self._get_role_params()
@ -132,7 +132,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
user['id'], role['id'])
self.client.auth_provider.clear_auth()
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
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()
@ -140,7 +140,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.assertRaises(exceptions.NotFound, self.client.assign_user_role,
tenant['id'], user['id'], non_existent_role)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
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()
@ -148,7 +148,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.assertRaises(exceptions.NotFound, self.client.assign_user_role,
non_existent_tenant, user['id'], role['id'])
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_assign_duplicate_user_role(self):
# Duplicate user role should not get assigned
(user, tenant, role) = self._get_role_params()
@ -156,7 +156,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.assertRaises(exceptions.Conflict, self.client.assign_user_role,
tenant['id'], user['id'], role['id'])
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_remove_user_role_by_unauthorized_user(self):
# Non-administrator user should not be authorized to
# remove a user's role
@ -168,7 +168,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.non_admin_client.remove_user_role,
tenant['id'], user['id'], role['id'])
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_remove_user_role_request_without_token(self):
# Request to remove a user's role without a valid token
(user, tenant, role) = self._get_role_params()
@ -182,7 +182,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
user['id'], role['id'])
self.client.auth_provider.clear_auth()
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_remove_user_role_non_existent_role(self):
# Attempt to delete a non existent role from a user should fail
(user, tenant, role) = self._get_role_params()
@ -193,7 +193,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.assertRaises(exceptions.NotFound, self.client.remove_user_role,
tenant['id'], user['id'], non_existent_role)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_remove_user_role_non_existent_tenant(self):
# Attempt to remove a role from a non existent tenant should fail
(user, tenant, role) = self._get_role_params()
@ -204,7 +204,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.assertRaises(exceptions.NotFound, self.client.remove_user_role,
non_existent_tenant, user['id'], role['id'])
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_list_user_roles_by_unauthorized_user(self):
# Non-administrator user should not be authorized to list
# a user's roles
@ -214,7 +214,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.non_admin_client.list_user_roles, tenant['id'],
user['id'])
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
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()

View File

@ -18,7 +18,7 @@ from six import moves
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest import test
class ServicesTestJSON(base.BaseIdentityV2AdminTest):
@ -32,7 +32,7 @@ class ServicesTestJSON(base.BaseIdentityV2AdminTest):
self.assertRaises(exceptions.NotFound, self.client.get_service,
service_id)
@attr(type='smoke')
@test.attr(type='smoke')
def test_create_get_delete_service(self):
# GET Service
# Creating a Service
@ -66,7 +66,7 @@ class ServicesTestJSON(base.BaseIdentityV2AdminTest):
self.assertEqual(fetched_service['description'],
service_data['description'])
@attr(type='gate')
@test.attr(type='gate')
def test_create_service_without_description(self):
# Create a service only with name and type
name = data_utils.rand_name('service-')
@ -80,7 +80,7 @@ class ServicesTestJSON(base.BaseIdentityV2AdminTest):
self.assertIn('type', service)
self.assertEqual(type, service['type'])
@attr(type='smoke')
@test.attr(type='smoke')
def test_list_services(self):
# Create, List, Verify and Delete Services
services = []

View File

@ -18,19 +18,19 @@ import uuid
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest import test
class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest):
_interface = 'json'
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_list_tenants_by_unauthorized_user(self):
# Non-administrator user should not be able to list tenants
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.list_tenants)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_list_tenant_request_without_token(self):
# Request to list tenants without a valid token should fail
token = self.client.auth_provider.get_token()
@ -38,7 +38,7 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.assertRaises(exceptions.Unauthorized, self.client.list_tenants)
self.client.auth_provider.clear_auth()
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_tenant_delete_by_unauthorized_user(self):
# Non-administrator user should not be able to delete a tenant
tenant_name = data_utils.rand_name(name='tenant-')
@ -48,7 +48,7 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.delete_tenant, tenant['id'])
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_tenant_delete_request_without_token(self):
# Request to delete a tenant without a valid token should fail
tenant_name = data_utils.rand_name(name='tenant-')
@ -61,13 +61,13 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest):
tenant['id'])
self.client.auth_provider.clear_auth()
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_delete_non_existent_tenant(self):
# Attempt to delete a non existent tenant should fail
self.assertRaises(exceptions.NotFound, self.client.delete_tenant,
str(uuid.uuid4().hex))
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_tenant_create_duplicate(self):
# Tenant names should be unique
tenant_name = data_utils.rand_name(name='tenant-')
@ -82,14 +82,14 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.assertRaises(exceptions.Conflict, self.client.create_tenant,
tenant_name)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_tenant_by_unauthorized_user(self):
# Non-administrator user should not be authorized to create a tenant
tenant_name = data_utils.rand_name(name='tenant-')
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.create_tenant, tenant_name)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_tenant_request_without_token(self):
# Create tenant request without a token should not be authorized
tenant_name = data_utils.rand_name(name='tenant-')
@ -99,26 +99,26 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest):
tenant_name)
self.client.auth_provider.clear_auth()
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_tenant_with_empty_name(self):
# Tenant name should not be empty
self.assertRaises(exceptions.BadRequest, self.client.create_tenant,
name='')
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_tenants_name_length_over_64(self):
# Tenant name length should not be greater than 64 characters
tenant_name = 'a' * 65
self.assertRaises(exceptions.BadRequest, self.client.create_tenant,
tenant_name)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_update_non_existent_tenant(self):
# Attempt to update a non existent tenant should fail
self.assertRaises(exceptions.NotFound, self.client.update_tenant,
str(uuid.uuid4().hex))
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_tenant_update_by_unauthorized_user(self):
# Non-administrator user should not be able to update a tenant
tenant_name = data_utils.rand_name(name='tenant-')
@ -128,7 +128,7 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.update_tenant, tenant['id'])
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_tenant_update_request_without_token(self):
# Request to update a tenant without a valid token should fail
tenant_name = data_utils.rand_name(name='tenant-')

View File

@ -17,13 +17,13 @@ from six import moves
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest import test
class TenantsTestJSON(base.BaseIdentityV2AdminTest):
_interface = 'json'
@attr(type='gate')
@test.attr(type='gate')
def test_tenant_list_delete(self):
# Create several tenants and delete them
tenants = []
@ -48,7 +48,7 @@ class TenantsTestJSON(base.BaseIdentityV2AdminTest):
found = [tenant for tenant in body if tenant['id'] in tenant_ids]
self.assertFalse(any(found), 'Tenants failed to delete')
@attr(type='gate')
@test.attr(type='gate')
def test_tenant_create_with_description(self):
# Create tenant with a description
tenant_name = data_utils.rand_name(name='tenant-')
@ -69,7 +69,7 @@ class TenantsTestJSON(base.BaseIdentityV2AdminTest):
self.client.delete_tenant(tenant_id)
self.data.tenants.remove(tenant)
@attr(type='gate')
@test.attr(type='gate')
def test_tenant_create_enabled(self):
# Create a tenant that is enabled
tenant_name = data_utils.rand_name(name='tenant-')
@ -86,7 +86,7 @@ class TenantsTestJSON(base.BaseIdentityV2AdminTest):
self.client.delete_tenant(tenant_id)
self.data.tenants.remove(tenant)
@attr(type='gate')
@test.attr(type='gate')
def test_tenant_create_not_enabled(self):
# Create a tenant that is not enabled
tenant_name = data_utils.rand_name(name='tenant-')
@ -105,7 +105,7 @@ class TenantsTestJSON(base.BaseIdentityV2AdminTest):
self.client.delete_tenant(tenant_id)
self.data.tenants.remove(tenant)
@attr(type='gate')
@test.attr(type='gate')
def test_tenant_update_name(self):
# Update name attribute of a tenant
t_name1 = data_utils.rand_name(name='tenant-')
@ -133,7 +133,7 @@ class TenantsTestJSON(base.BaseIdentityV2AdminTest):
self.client.delete_tenant(t_id)
self.data.tenants.remove(tenant)
@attr(type='gate')
@test.attr(type='gate')
def test_tenant_update_desc(self):
# Update description attribute of a tenant
t_name = data_utils.rand_name(name='tenant-')
@ -162,7 +162,7 @@ class TenantsTestJSON(base.BaseIdentityV2AdminTest):
self.client.delete_tenant(t_id)
self.data.tenants.remove(tenant)
@attr(type='gate')
@test.attr(type='gate')
def test_tenant_update_enable(self):
# Update the enabled attribute of a tenant
t_name = data_utils.rand_name(name='tenant-')

View File

@ -15,13 +15,13 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest import test
class TokensTestJSON(base.BaseIdentityV2AdminTest):
_interface = 'json'
@attr(type='gate')
@test.attr(type='gate')
def test_create_get_delete_token(self):
# get a token by username and password
user_name = data_utils.rand_name(name='user-')
@ -56,7 +56,7 @@ class TokensTestJSON(base.BaseIdentityV2AdminTest):
resp, body = self.client.delete_token(token_id)
self.assertEqual(resp['status'], '204')
@attr(type='gate')
@test.attr(type='gate')
def test_rescope_token(self):
"""An unscoped token can be requested, that token can be used to
request a scoped token.

View File

@ -18,7 +18,7 @@ import uuid
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest import test
class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
@ -31,7 +31,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
cls.alt_password = data_utils.rand_name('pass_')
cls.alt_email = cls.alt_user + '@testmail.tm'
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_user_by_unauthorized_user(self):
# Non-administrator should not be authorized to create a user
self.data.setup_test_tenant()
@ -40,7 +40,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.alt_password, self.data.tenant['id'],
self.alt_email)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_user_with_empty_name(self):
# User with an empty name should not be created
self.data.setup_test_tenant()
@ -48,7 +48,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.alt_password, self.data.tenant['id'],
self.alt_email)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_user_with_name_length_over_255(self):
# Length of user name filed should be restricted to 255 characters
self.data.setup_test_tenant()
@ -56,7 +56,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
'a' * 256, self.alt_password,
self.data.tenant['id'], self.alt_email)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_user_with_duplicate_name(self):
# Duplicate user should not be created
self.data.setup_test_user()
@ -64,14 +64,14 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.data.test_user, self.data.test_password,
self.data.tenant['id'], self.data.test_email)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_user_for_non_existent_tenant(self):
# Attempt to create a user in a non-existent tenant should fail
self.assertRaises(exceptions.NotFound, self.client.create_user,
self.alt_user, self.alt_password, '49ffgg99999',
self.alt_email)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_user_request_without_a_token(self):
# Request to create a user without a valid token should fail
self.data.setup_test_tenant()
@ -86,7 +86,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
# Unset the token to allow further tests to generate a new token
self.client.auth_provider.clear_auth()
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_user_with_enabled_non_bool(self):
# Attempt to create a user with valid enabled para should fail
self.data.setup_test_tenant()
@ -96,7 +96,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.data.tenant['id'],
self.alt_email, enabled=3)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_update_user_for_non_existent_user(self):
# Attempt to update a user non-existent user should fail
user_name = data_utils.rand_name('user-')
@ -104,7 +104,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.assertRaises(exceptions.NotFound, self.client.update_user,
non_existent_id, name=user_name)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_update_user_request_without_a_token(self):
# Request to update a user without a valid token should fail
@ -118,14 +118,14 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
# Unset the token to allow further tests to generate a new token
self.client.auth_provider.clear_auth()
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_update_user_by_unauthorized_user(self):
# Non-administrator should not be authorized to update user
self.data.setup_test_tenant()
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.update_user, self.alt_user)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_delete_users_by_unauthorized_user(self):
# Non-administrator user should not be authorized to delete a user
self.data.setup_test_user()
@ -133,13 +133,13 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.non_admin_client.delete_user,
self.data.user['id'])
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_delete_non_existent_user(self):
# Attempt to delete a non-existent user should fail
self.assertRaises(exceptions.NotFound, self.client.delete_user,
'junk12345123')
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_delete_user_request_without_a_token(self):
# Request to delete a user without a valid token should fail
@ -153,7 +153,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
# Unset the token to allow further tests to generate a new token
self.client.auth_provider.clear_auth()
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_authentication_for_disabled_user(self):
# Disabled user's token should not get authenticated
self.data.setup_test_user()
@ -163,7 +163,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.data.test_password,
self.data.test_tenant)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_authentication_when_tenant_is_disabled(self):
# User's token for a disabled tenant should not be authenticated
self.data.setup_test_user()
@ -173,7 +173,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.data.test_password,
self.data.test_tenant)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_authentication_with_invalid_tenant(self):
# User's token for an invalid tenant should not be authenticated
self.data.setup_test_user()
@ -182,7 +182,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.data.test_password,
'junktenant1234')
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_authentication_with_invalid_username(self):
# Non-existent user's token should not get authenticated
self.data.setup_test_user()
@ -190,7 +190,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
'junkuser123', self.data.test_password,
self.data.test_tenant)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_authentication_with_invalid_password(self):
# User's token with invalid password should not be authenticated
self.data.setup_test_user()
@ -198,14 +198,14 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.data.test_user, 'junkpass1234',
self.data.test_tenant)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_get_users_by_unauthorized_user(self):
# Non-administrator 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', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_get_users_request_without_token(self):
# Request to get list of users without a valid token should fail
token = self.client.auth_provider.get_token()
@ -213,7 +213,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
self.assertRaises(exceptions.Unauthorized, self.client.get_users)
self.client.auth_provider.clear_auth()
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_list_users_with_invalid_tenant(self):
# Should not be able to return a list of all
# users for a non-existent tenant

View File

@ -16,7 +16,7 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest import test
class DomainsTestJSON(base.BaseIdentityV3AdminTest):
@ -29,7 +29,7 @@ class DomainsTestJSON(base.BaseIdentityV3AdminTest):
resp, _ = self.client.delete_domain(domain_id)
self.assertEqual(204, resp.status)
@attr(type='smoke')
@test.attr(type='smoke')
def test_list_domains(self):
# Test to list domains
domain_ids = list()
@ -49,7 +49,7 @@ class DomainsTestJSON(base.BaseIdentityV3AdminTest):
missing_doms = [d for d in domain_ids if d not in fetched_ids]
self.assertEqual(0, len(missing_doms))
@attr(type='smoke')
@test.attr(type='smoke')
def test_create_update_delete_domain(self):
d_name = data_utils.rand_name('domain-')
d_desc = data_utils.rand_name('domain-desc-')

View File

@ -18,7 +18,7 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest import test
class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest):
@ -45,7 +45,7 @@ class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest):
cls.service_client.delete_service(s)
super(EndpointsNegativeTestJSON, cls).tearDownClass()
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_with_enabled_False(self):
# Enabled should be a boolean, not a string like 'False'
interface = 'public'
@ -55,7 +55,7 @@ class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest):
self.service_id, interface, url, region=region,
force_enabled='False')
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_create_with_enabled_True(self):
# Enabled should be a boolean, not a string like 'True'
interface = 'public'
@ -79,12 +79,12 @@ class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest):
self.assertRaises(exceptions.BadRequest, self.client.update_endpoint,
endpoint_for_update['id'], force_enabled=enabled)
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_update_with_enabled_False(self):
# Enabled should be a boolean, not a string like 'False'
self._assert_update_raises_bad_request('False')
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_update_with_enabled_True(self):
# Enabled should be a boolean, not a string like 'True'
self._assert_update_raises_bad_request('True')

View File

@ -15,7 +15,7 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest import test
class PoliciesTestJSON(base.BaseIdentityV3AdminTest):
@ -25,7 +25,7 @@ class PoliciesTestJSON(base.BaseIdentityV3AdminTest):
resp, _ = self.policy_client.delete_policy(policy_id)
self.assertEqual(204, resp.status)
@attr(type='smoke')
@test.attr(type='smoke')
def test_list_policies(self):
# Test to list policies
policy_ids = list()
@ -46,7 +46,7 @@ class PoliciesTestJSON(base.BaseIdentityV3AdminTest):
missing_pols = [p for p in policy_ids if p not in fetched_ids]
self.assertEqual(0, len(missing_pols))
@attr(type='smoke')
@test.attr(type='smoke')
def test_create_update_delete_policy(self):
# Test to update policy
blob = data_utils.rand_name('BlobName-')

View File

@ -16,13 +16,13 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest import test
class ServicesTestJSON(base.BaseIdentityV3AdminTest):
_interface = 'json'
@attr(type='gate')
@test.attr(type='gate')
def test_update_service(self):
# Update description attribute of service
name = data_utils.rand_name('service-')

View File

@ -16,13 +16,13 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest import test
class TokensV3TestJSON(base.BaseIdentityV3AdminTest):
_interface = 'json'
@attr(type='smoke')
@test.attr(type='smoke')
def test_tokens(self):
# Valid user's token is authenticated
# Create a User
@ -50,7 +50,7 @@ class TokensV3TestJSON(base.BaseIdentityV3AdminTest):
self.assertRaises(exceptions.NotFound, self.client.get_token,
subject_token)
@attr(type='gate')
@test.attr(type='gate')
def test_rescope_token(self):
"""Rescope a token.

View File

@ -15,13 +15,13 @@
from tempest.api.identity import base
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest import test
class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
_interface = 'json'
@attr(type='gate')
@test.attr(type='gate')
def test_user_update(self):
# Test case to check if updating of user attributes is successful.
# Creating first user
@ -66,7 +66,7 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
self.assertEqual(u_email2, new_user_get['email'])
self.assertEqual('false', str(new_user_get['enabled']).lower())
@attr(type='gate')
@test.attr(type='gate')
def test_list_user_projects(self):
# List the projects that a user has access upon
assigned_project_ids = list()
@ -120,7 +120,7 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
', '.join(m_project for m_project
in missing_projects))
@attr(type='gate')
@test.attr(type='gate')
def test_get_user(self):
# Get a user detail
self.data.setup_test_v3_user()

View File

@ -17,37 +17,37 @@
from tempest.api.network import base
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest import test
class NetworksNegativeTestJSON(base.BaseNetworkTest):
_interface = 'json'
@attr(type=['negative', 'smoke'])
@test.attr(type=['negative', 'smoke'])
def test_show_non_existent_network(self):
non_exist_id = data_utils.rand_name('network')
self.assertRaises(exceptions.NotFound, self.client.show_network,
non_exist_id)
@attr(type=['negative', 'smoke'])
@test.attr(type=['negative', 'smoke'])
def test_show_non_existent_subnet(self):
non_exist_id = data_utils.rand_name('subnet')
self.assertRaises(exceptions.NotFound, self.client.show_subnet,
non_exist_id)
@attr(type=['negative', 'smoke'])
@test.attr(type=['negative', 'smoke'])
def test_show_non_existent_port(self):
non_exist_id = data_utils.rand_name('port')
self.assertRaises(exceptions.NotFound, self.client.show_port,
non_exist_id)
@attr(type=['negative', 'smoke'])
@test.attr(type=['negative', 'smoke'])
def test_update_non_existent_network(self):
non_exist_id = data_utils.rand_name('network')
self.assertRaises(exceptions.NotFound, self.client.update_network,
non_exist_id, name="new_name")
@attr(type=['negative', 'smoke'])
@test.attr(type=['negative', 'smoke'])
def test_delete_non_existent_network(self):
non_exist_id = data_utils.rand_name('network')
self.assertRaises(exceptions.NotFound, self.client.delete_network,

View File

@ -17,12 +17,12 @@
from tempest.api.object_storage import base
from tempest import clients
from tempest import exceptions
from tempest.test import attr
from tempest import test
class AccountNegativeTest(base.BaseObjectTest):
@attr(type=['negative', 'gate'])
@test.attr(type=['negative', 'gate'])
def test_list_containers_with_non_authorized_user(self):
# list containers using non-authorized user

View File

@ -16,7 +16,7 @@ from tempest.api.orchestration import base
from tempest.common.utils import data_utils
from tempest import config
from tempest import exceptions
from tempest.test import attr
from tempest import test
CONF = config.CONF
@ -25,7 +25,7 @@ LOG = logging.getLogger(__name__)
class TestServerStackLimits(base.BaseOrchestrationTest):
@attr(type='gate')
@test.attr(type='gate')
def test_exceed_max_template_size_fails(self):
stack_name = data_utils.rand_name('heat')
fill = 'A' * CONF.orchestration.max_template_size
@ -38,7 +38,7 @@ Outputs:
stack_name, template)
self.assertIn('Template exceeds maximum allowed size', str(ex))
@attr(type='gate')
@test.attr(type='gate')
def test_exceed_max_resources_per_stack(self):
stack_name = data_utils.rand_name('heat')
# Create a big template, one resource more than the limit

View File

@ -14,7 +14,7 @@ import logging
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest import test
LOG = logging.getLogger(__name__)
@ -48,14 +48,14 @@ class StacksTestJSON(base.BaseOrchestrationTest):
self.assertEqual(expected_num, len(stacks))
return stacks
@attr(type='gate')
@test.attr(type='gate')
def test_stack_list(self):
"""Created stack should be in the list of existing stacks."""
stacks = self._list_stacks()
stacks_names = map(lambda stack: stack['stack_name'], stacks)
self.assertIn(self.stack_name, stacks_names)
@attr(type='gate')
@test.attr(type='gate')
def test_stack_show(self):
"""Getting details about created stack should be possible."""
resp, stack = self.client.get_stack(self.stack_name)
@ -75,7 +75,7 @@ class StacksTestJSON(base.BaseOrchestrationTest):
self.assertEqual(self.stack_id, stack['id'])
self.assertEqual('fluffy', stack['outputs'][0]['output_key'])
@attr(type='gate')
@test.attr(type='gate')
def test_suspend_resume_stack(self):
"""Suspend and resume a stack."""
resp, suspend_stack = self.client.suspend_stack(self.stack_identifier)
@ -87,14 +87,14 @@ class StacksTestJSON(base.BaseOrchestrationTest):
self.client.wait_for_stack_status(self.stack_identifier,
'RESUME_COMPLETE')
@attr(type='gate')
@test.attr(type='gate')
def test_list_resources(self):
"""Getting 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)
@attr(type='gate')
@test.attr(type='gate')
def test_show_resource(self):
"""Getting details about created resource should be possible."""
resp, resource = self.client.get_resource(self.stack_identifier,
@ -108,7 +108,7 @@ class StacksTestJSON(base.BaseOrchestrationTest):
self.assertEqual(self.resource_name, resource['logical_resource_id'])
self.assertEqual(self.resource_type, resource['resource_type'])
@attr(type='gate')
@test.attr(type='gate')
def test_resource_metadata(self):
"""Getting metadata for created resources should be possible."""
resp, metadata = self.client.show_resource_metadata(
@ -118,7 +118,7 @@ class StacksTestJSON(base.BaseOrchestrationTest):
self.assertIsInstance(metadata, dict)
self.assertEqual(['Tom', 'Stinky'], metadata.get('kittens', None))
@attr(type='gate')
@test.attr(type='gate')
def test_list_events(self):
"""Getting list of created events for the stack should be possible."""
resp, events = self.client.list_events(self.stack_identifier)
@ -134,7 +134,7 @@ class StacksTestJSON(base.BaseOrchestrationTest):
self.assertIn('CREATE_IN_PROGRESS', resource_statuses)
self.assertIn('CREATE_COMPLETE', resource_statuses)
@attr(type='gate')
@test.attr(type='gate')
def test_show_event(self):
"""Getting details about an event should be possible."""
resp, events = self.client.list_resource_events(self.stack_identifier,

View File

@ -15,7 +15,7 @@ import logging
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
from tempest.test import attr
from tempest import test
LOG = logging.getLogger(__name__)
@ -46,7 +46,7 @@ class NovaKeyPairResourcesYAMLTest(base.BaseOrchestrationTest):
for resource in resources:
cls.test_resources[resource['logical_resource_id']] = resource
@attr(type='slow')
@test.attr(type='slow')
def test_created_resources(self):
"""Verifies created keypair resource."""
resources = [('KeyPairSavePrivate', 'OS::Nova::KeyPair'),
@ -59,7 +59,7 @@ class NovaKeyPairResourcesYAMLTest(base.BaseOrchestrationTest):
self.assertEqual(resource_type, resource['resource_type'])
self.assertEqual('CREATE_COMPLETE', resource['resource_status'])
@attr(type='slow')
@test.attr(type='slow')
def test_stack_keypairs_output(self):
resp, stack = self.client.get_stack(self.stack_name)
self.assertEqual('200', resp['status'])

View File

@ -13,7 +13,7 @@
from tempest.api.orchestration import base
from tempest.common.utils import data_utils
from tempest.openstack.common import log as logging
from tempest.test import attr
from tempest import test
LOG = logging.getLogger(__name__)
@ -26,13 +26,13 @@ class StacksTestJSON(base.BaseOrchestrationTest):
def setUpClass(cls):
super(StacksTestJSON, cls).setUpClass()
@attr(type='smoke')
@test.attr(type='smoke')
def test_stack_list_responds(self):
resp, stacks = self.client.list_stacks()
self.assertEqual('200', resp['status'])
self.assertIsInstance(stacks, list)
@attr(type='smoke')
@test.attr(type='smoke')
def test_stack_crud_no_resources(self):
stack_name = data_utils.rand_name('heat')

View File

@ -13,7 +13,7 @@
from tempest.api.telemetry import base
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest.test import attr
from tempest import test
class TelemetryAlarmingAPITestJSON(base.BaseTelemetryTest):
@ -29,7 +29,7 @@ class TelemetryAlarmingAPITestJSON(base.BaseTelemetryTest):
for i in range(2):
cls.create_alarm(threshold_rule=cls.rule)
@attr(type="gate")
@test.attr(type="gate")
def test_alarm_list(self):
# List alarms
resp, alarm_list = self.telemetry_client.list_alarms()
@ -43,7 +43,7 @@ class TelemetryAlarmingAPITestJSON(base.BaseTelemetryTest):
" in a fetched list: %s" %
', '.join(str(a) for a in missing_alarms))
@attr(type="gate")
@test.attr(type="gate")
def test_create_update_get_delete_alarm(self):
# Create an alarm
alarm_name = data_utils.rand_name('telemetry_alarm')
@ -78,7 +78,7 @@ class TelemetryAlarmingAPITestJSON(base.BaseTelemetryTest):
self.assertRaises(exceptions.NotFound,
self.telemetry_client.get_alarm, alarm_id)
@attr(type="gate")
@test.attr(type="gate")
def test_set_get_alarm_state(self):
alarm_states = ['ok', 'alarm', 'insufficient data']
_, alarm = self.create_alarm(threshold_rule=self.rule)
@ -94,7 +94,7 @@ class TelemetryAlarmingAPITestJSON(base.BaseTelemetryTest):
self.assertEqual(200, resp.status)
self.assertEqual(new_state, state)
@attr(type="gate")
@test.attr(type="gate")
def test_create_delete_alarm_with_combination_rule(self):
rule = {"alarm_ids": self.alarm_ids,
"operator": "or"}

View File

@ -17,7 +17,7 @@ import keystoneclient.exceptions
import keystoneclient.v2_0.client
from tempest import auth
from tempest.common.rest_client import NegativeRestClient
from tempest.common import rest_client
from tempest import config
from tempest import exceptions
from tempest import manager
@ -355,7 +355,8 @@ class Manager(manager.Manager):
self.auth_provider)
self.token_client = TokenClientJSON()
self.token_v3_client = V3TokenClientJSON()
self.negative_client = NegativeRestClient(self.auth_provider)
self.negative_client = rest_client.NegativeRestClient(
self.auth_provider)
self.negative_client.service = service
else:

View File

@ -20,7 +20,7 @@ from tempest.common.utils import data_utils
from tempest import config
from tempest.openstack.common import log as logging
from tempest.scenario import manager
from tempest.test import services
from tempest import test
CONF = config.CONF
LOG = logging.getLogger(__name__)
@ -140,7 +140,7 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest):
'ACTIVE')
self._check_network_connectivity()
@services('compute', 'network')
@test.services('compute', 'network')
def test_server_connectivity_stop_start(self):
self.server.stop()
self.status_timeout(self.compute_client.servers, self.server.id,
@ -149,12 +149,12 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest):
self.server.start()
self._wait_server_status_and_check_network_connectivity()
@services('compute', 'network')
@test.services('compute', 'network')
def test_server_connectivity_reboot(self):
self.server.reboot()
self._wait_server_status_and_check_network_connectivity()
@services('compute', 'network')
@test.services('compute', 'network')
def test_server_connectivity_rebuild(self):
image_ref_alt = CONF.compute.image_ref_alt
self.server.rebuild(image_ref_alt)
@ -162,7 +162,7 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest):
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
'Pause is not available.')
@services('compute', 'network')
@test.services('compute', 'network')
def test_server_connectivity_pause_unpause(self):
self.server.pause()
self.status_timeout(self.compute_client.servers, self.server.id,
@ -173,7 +173,7 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest):
@testtools.skipUnless(CONF.compute_feature_enabled.suspend,
'Suspend is not available.')
@services('compute', 'network')
@test.services('compute', 'network')
def test_server_connectivity_suspend_resume(self):
self.server.suspend()
self.status_timeout(self.compute_client.servers, self.server.id,
@ -184,7 +184,7 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest):
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
'Resize is not available.')
@services('compute', 'network')
@test.services('compute', 'network')
def test_server_connectivity_resize(self):
resize_flavor = CONF.compute.flavor_ref_alt
if resize_flavor == CONF.compute.flavor_ref:

View File

@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from ast import literal_eval
import ast
from lxml import etree
from tempest.common import xml_utils as xml
@ -35,7 +35,7 @@ class VolumeQuotasClientXML(volume_quotas_client.VolumeQuotasClientJSON):
quota = {}
for k, v in q.items():
try:
v = literal_eval(v)
v = ast.literal_eval(v)
except (ValueError, SyntaxError):
pass

View File

@ -14,7 +14,6 @@
# under the License.
import mock
from mock import patch
from tempest.common.utils import file_utils
from tempest.tests import base
@ -23,7 +22,7 @@ from tempest.tests import base
class TestFileUtils(base.TestCase):
def test_have_effective_read_path(self):
with patch('__builtin__.open', mock.mock_open(), create=True):
with mock.patch('__builtin__.open', mock.mock_open(), create=True):
result = file_utils.have_effective_read_access('fake_path')
self.assertTrue(result)

View File

@ -13,7 +13,7 @@
# under the License.
import keystoneclient.v2_0.client as keystoneclient
from mock import patch
import mock
import neutronclient.v2_0.client as neutronclient
from oslo.config import cfg
@ -114,7 +114,7 @@ class TestTenantIsolation(base.TestCase):
{'router': {'id': id, 'name': name}})))
return router_fix
@patch('tempest.common.rest_client.RestClient')
@mock.patch('tempest.common.rest_client.RestClient')
def test_primary_creds(self, MockRestClient):
cfg.CONF.set_default('neutron', False, 'service_available')
iso_creds = isolated_creds.IsolatedCreds('test class',
@ -128,7 +128,7 @@ class TestTenantIsolation(base.TestCase):
self.assertEqual(primary_creds.tenant_id, '1234')
self.assertEqual(primary_creds.user_id, '1234')
@patch('tempest.common.rest_client.RestClient')
@mock.patch('tempest.common.rest_client.RestClient')
def test_admin_creds(self, MockRestClient):
cfg.CONF.set_default('neutron', False, 'service_available')
iso_creds = isolated_creds.IsolatedCreds('test class',
@ -141,12 +141,12 @@ class TestTenantIsolation(base.TestCase):
return_value=({'status': 200},
[{'id': '1234', 'name': 'admin'}])))
user_mock = patch.object(json_iden_client.IdentityClientJSON,
'assign_user_role')
user_mock = mock.patch.object(json_iden_client.IdentityClientJSON,
'assign_user_role')
user_mock.start()
self.addCleanup(user_mock.stop)
with patch.object(json_iden_client.IdentityClientJSON,
'assign_user_role') as user_mock:
with mock.patch.object(json_iden_client.IdentityClientJSON,
'assign_user_role') as user_mock:
admin_creds = iso_creds.get_admin_creds()
user_mock.assert_called_once_with('1234', '1234', '1234')
self.assertEqual(admin_creds.username, 'fake_admin_user')
@ -155,7 +155,7 @@ class TestTenantIsolation(base.TestCase):
self.assertEqual(admin_creds.tenant_id, '1234')
self.assertEqual(admin_creds.user_id, '1234')
@patch('tempest.common.rest_client.RestClient')
@mock.patch('tempest.common.rest_client.RestClient')
def test_all_cred_cleanup(self, MockRestClient):
cfg.CONF.set_default('neutron', False, 'service_available')
iso_creds = isolated_creds.IsolatedCreds('test class',
@ -177,8 +177,8 @@ class TestTenantIsolation(base.TestCase):
'list_roles',
return_value=({'status': 200},
[{'id': '123456', 'name': 'admin'}])))
with patch.object(json_iden_client.IdentityClientJSON,
'assign_user_role'):
with mock.patch.object(json_iden_client.IdentityClientJSON,
'assign_user_role'):
iso_creds.get_admin_creds()
user_mock = self.patch(
'tempest.services.identity.json.identity_client.'
@ -202,7 +202,7 @@ class TestTenantIsolation(base.TestCase):
self.assertIn('12345', args)
self.assertIn('123456', args)
@patch('tempest.common.rest_client.RestClient')
@mock.patch('tempest.common.rest_client.RestClient')
def test_alt_creds(self, MockRestClient):
cfg.CONF.set_default('neutron', False, 'service_available')
iso_creds = isolated_creds.IsolatedCreds('test class',
@ -216,7 +216,7 @@ class TestTenantIsolation(base.TestCase):
self.assertEqual(alt_creds.tenant_id, '1234')
self.assertEqual(alt_creds.user_id, '1234')
@patch('tempest.common.rest_client.RestClient')
@mock.patch('tempest.common.rest_client.RestClient')
def test_network_creation(self, MockRestClient):
iso_creds = isolated_creds.IsolatedCreds('test class',
password='fake_password')
@ -240,7 +240,7 @@ class TestTenantIsolation(base.TestCase):
self.assertEqual(router['id'], '1234')
self.assertEqual(router['name'], 'fake_router')
@patch('tempest.common.rest_client.RestClient')
@mock.patch('tempest.common.rest_client.RestClient')
def test_network_cleanup(self, MockRestClient):
iso_creds = isolated_creds.IsolatedCreds('test class',
password='fake_password')
@ -289,28 +289,28 @@ class TestTenantIsolation(base.TestCase):
'list_roles',
return_value=({'status': 200},
[{'id': '123456', 'name': 'admin'}])))
with patch.object(json_iden_client.IdentityClientJSON,
'assign_user_role'):
with mock.patch.object(json_iden_client.IdentityClientJSON,
'assign_user_role'):
iso_creds.get_admin_creds()
self.patch('tempest.services.identity.json.identity_client.'
'IdentityClientJSON.delete_user')
self.patch('tempest.services.identity.json.identity_client.'
'IdentityClientJSON.delete_tenant')
net = patch.object(iso_creds.network_admin_client,
'delete_network')
net = mock.patch.object(iso_creds.network_admin_client,
'delete_network')
net_mock = net.start()
subnet = patch.object(iso_creds.network_admin_client,
'delete_subnet')
subnet = mock.patch.object(iso_creds.network_admin_client,
'delete_subnet')
subnet_mock = subnet.start()
router = patch.object(iso_creds.network_admin_client,
'delete_router')
router = mock.patch.object(iso_creds.network_admin_client,
'delete_router')
router_mock = router.start()
remove_router_interface_mock = self.patch(
'tempest.services.network.json.network_client.NetworkClientJSON.'
'remove_router_interface_with_subnet_id')
port_list_mock = patch.object(iso_creds.network_admin_client,
'list_ports', return_value=(
{'status': 200}, {'ports': []}))
port_list_mock = mock.patch.object(iso_creds.network_admin_client,
'list_ports', return_value=(
{'status': 200}, {'ports': []}))
port_list_mock.start()
iso_creds.clear_isolated_creds()
# Verify remove router interface calls
@ -342,7 +342,7 @@ class TestTenantIsolation(base.TestCase):
self.assertIn('12345', args)
self.assertIn('123456', args)
@patch('tempest.common.rest_client.RestClient')
@mock.patch('tempest.common.rest_client.RestClient')
def test_network_alt_creation(self, MockRestClient):
iso_creds = isolated_creds.IsolatedCreds('test class',
password='fake_password')
@ -366,7 +366,7 @@ class TestTenantIsolation(base.TestCase):
self.assertEqual(router['id'], '1234')
self.assertEqual(router['name'], 'fake_alt_router')
@patch('tempest.common.rest_client.RestClient')
@mock.patch('tempest.common.rest_client.RestClient')
def test_network_admin_creation(self, MockRestClient):
iso_creds = isolated_creds.IsolatedCreds('test class',
password='fake_password')
@ -383,8 +383,8 @@ class TestTenantIsolation(base.TestCase):
'list_roles',
return_value=({'status': 200},
[{'id': '123456', 'name': 'admin'}])))
with patch.object(json_iden_client.IdentityClientJSON,
'assign_user_role'):
with mock.patch.object(json_iden_client.IdentityClientJSON,
'assign_user_role'):
iso_creds.get_admin_creds()
router_interface_mock.called_once_with('1234', '1234')
network = iso_creds.get_admin_network()
@ -397,7 +397,7 @@ class TestTenantIsolation(base.TestCase):
self.assertEqual(router['id'], '1234')
self.assertEqual(router['name'], 'fake_admin_router')
@patch('tempest.common.rest_client.RestClient')
@mock.patch('tempest.common.rest_client.RestClient')
def test_no_network_resources(self, MockRestClient):
net_dict = {
'network': False,
@ -410,14 +410,14 @@ class TestTenantIsolation(base.TestCase):
network_resources=net_dict)
self._mock_user_create('1234', 'fake_prim_user')
self._mock_tenant_create('1234', 'fake_prim_tenant')
net = patch.object(iso_creds.network_admin_client,
'delete_network')
net = mock.patch.object(iso_creds.network_admin_client,
'delete_network')
net_mock = net.start()
subnet = patch.object(iso_creds.network_admin_client,
'delete_subnet')
subnet = mock.patch.object(iso_creds.network_admin_client,
'delete_subnet')
subnet_mock = subnet.start()
router = patch.object(iso_creds.network_admin_client,
'delete_router')
router = mock.patch.object(iso_creds.network_admin_client,
'delete_router')
router_mock = router.start()
iso_creds.get_primary_creds()
@ -431,7 +431,7 @@ class TestTenantIsolation(base.TestCase):
self.assertIsNone(subnet)
self.assertIsNone(router)
@patch('tempest.common.rest_client.RestClient')
@mock.patch('tempest.common.rest_client.RestClient')
def test_router_without_network(self, MockRestClient):
net_dict = {
'network': False,
@ -447,7 +447,7 @@ class TestTenantIsolation(base.TestCase):
self.assertRaises(exceptions.InvalidConfiguration,
iso_creds.get_primary_creds)
@patch('tempest.common.rest_client.RestClient')
@mock.patch('tempest.common.rest_client.RestClient')
def test_subnet_without_network(self, MockRestClient):
net_dict = {
'network': False,
@ -463,7 +463,7 @@ class TestTenantIsolation(base.TestCase):
self.assertRaises(exceptions.InvalidConfiguration,
iso_creds.get_primary_creds)
@patch('tempest.common.rest_client.RestClient')
@mock.patch('tempest.common.rest_client.RestClient')
def test_dhcp_without_subnet(self, MockRestClient):
net_dict = {
'network': False,

View File

@ -99,6 +99,6 @@ import_exceptions = tempest.services
[flake8]
# E125 is a won't fix until https://github.com/jcrocholl/pep8/issues/126 is resolved. For further detail see https://review.openstack.org/#/c/36788/
ignore = E125,H302,H404
ignore = E125,H404
show-source = True
exclude = .git,.venv,.tox,dist,doc,openstack,*egg