test.py: stop using aliases for creds manager

It could be confusing to new comers that the variables
cls.os and cls.os_primary or cls.alt_manager and cls.os_alt
actually are aliases. Besides we are not consistent in their usage.

This patch normalizes the usage around os_admin, os_primary and
os_alt. We keep the old aliases for compatibility but we should not
use them anymore.

This fix a long standing TODO item.

Change-Id: I5f7164f7a7ec5d4380ca22885000caa0183a0bf7
This commit is contained in:
Jordan Pittier 2017-04-18 11:52:23 +02:00
parent 5ee0941501
commit 8160d31e58
72 changed files with 301 additions and 276 deletions

View File

@ -99,7 +99,7 @@ of these would be::
specific situations you should not need to use this.
"""
super(TestExampleCase, cls).setup_clients()
cls.servers_client = cls.os.servers_client
cls.servers_client = cls.os_primary.servers_client
@classmethod
def resource_setup(cls):
@ -143,10 +143,10 @@ to set a class variable ``credentials`` on the TestCase directly. For example::
In this example the ``TestExampleAdmin`` TestCase will allocate 2 sets of
credentials, one regular user and one admin user. The corresponding manager
objects will be set as class variables cls.os and cls.os_adm respectively. You
can also allocate a second user by putting **'alt'** in the list too. A set of
alt credentials are the same as primary but can be used for tests cases that
need a second user/project.
objects will be set as class variables ``cls.os_primary`` and ``cls.os_admin``
respectively. You can also allocate a second user by putting **'alt'** in the
list too. A set of alt credentials are the same as primary but can be used
for tests cases that need a second user/project.
You can also specify credentials with specific roles assigned. This is useful
for cases where there are specific RBAC requirements hard coded into an API.

View File

@ -23,7 +23,7 @@ class AgentsAdminTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(AgentsAdminTestJSON, cls).setup_clients()
cls.client = cls.os_adm.agents_client
cls.client = cls.os_admin.agents_client
@classmethod
def resource_setup(cls):

View File

@ -31,7 +31,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(AggregatesAdminTestJSON, cls).setup_clients()
cls.client = cls.os_adm.aggregates_client
cls.client = cls.os_admin.aggregates_client
@classmethod
def resource_setup(cls):
@ -40,7 +40,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
cls.az_name_prefix = 'test_az'
cls.host = None
hypers = cls.os_adm.hypervisor_client.list_hypervisors(
hypers = cls.os_admin.hypervisor_client.list_hypervisors(
detail=True)['hypervisors']
if CONF.compute.hypervisor_type:
@ -226,7 +226,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest):
self.client.add_host(aggregate['id'], host=self.host)
self.addCleanup(self.client.remove_host, aggregate['id'],
host=self.host)
admin_servers_client = self.os_adm.servers_client
admin_servers_client = self.os_admin.servers_client
server = self.create_test_server(availability_zone=az_name,
wait_until='ACTIVE')
body = admin_servers_client.show_server(server['id'])['server']

View File

@ -26,7 +26,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(AggregatesAdminNegativeTestJSON, cls).setup_clients()
cls.client = cls.os_adm.aggregates_client
cls.client = cls.os_admin.aggregates_client
cls.user_client = cls.aggregates_client
@classmethod
@ -34,7 +34,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
super(AggregatesAdminNegativeTestJSON, cls).resource_setup()
cls.aggregate_name_prefix = 'test_aggregate'
hosts_all = cls.os_adm.hosts_client.list_hosts()['hosts']
hosts_all = cls.os_admin.hosts_client.list_hosts()['hosts']
hosts = ([host['host_name']
for host in hosts_all if host['service'] == 'compute'])
cls.host = hosts[0]
@ -124,7 +124,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
@decorators.idempotent_id('0ef07828-12b4-45ba-87cc-41425faf5711')
def test_aggregate_add_non_exist_host(self):
# Adding a non-exist host to an aggregate should raise exceptions.
hosts_all = self.os_adm.hosts_client.list_hosts()['hosts']
hosts_all = self.os_admin.hosts_client.list_hosts()['hosts']
hosts = map(lambda x: x['host_name'], hosts_all)
while True:
non_exist_host = data_utils.rand_name('nonexist_host')

View File

@ -66,10 +66,10 @@ class AutoAllocateNetworkTest(base.BaseV2ComputeTest):
@classmethod
def setup_clients(cls):
super(AutoAllocateNetworkTest, cls).setup_clients()
cls.networks_client = cls.os.networks_client
cls.routers_client = cls.os.routers_client
cls.subnets_client = cls.os.subnets_client
cls.ports_client = cls.os.ports_client
cls.networks_client = cls.os_primary.networks_client
cls.routers_client = cls.os_primary.routers_client
cls.subnets_client = cls.os_primary.subnets_client
cls.ports_client = cls.os_primary.ports_client
@classmethod
def resource_setup(cls):

View File

@ -33,7 +33,7 @@ class FixedIPsTestJson(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(FixedIPsTestJson, cls).setup_clients()
cls.client = cls.os_adm.fixed_ips_client
cls.client = cls.os_admin.fixed_ips_client
@classmethod
def resource_setup(cls):

View File

@ -33,7 +33,7 @@ class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(FixedIPsNegativeTestJson, cls).setup_clients()
cls.client = cls.os_adm.fixed_ips_client
cls.client = cls.os_admin.fixed_ips_client
cls.non_admin_client = cls.fixed_ips_client
@classmethod

View File

@ -163,7 +163,7 @@ class FlavorsAdminTestJSON(base.BaseV2ComputeAdminTest):
# Verify flavor is not used by other user
self.assertRaises(lib_exc.BadRequest,
self.os.servers_client.create_server,
self.os_primary.servers_client.create_server,
name='test', imageRef=self.image_ref,
flavorRef=flavor['id'])

View File

@ -35,7 +35,7 @@ class FloatingIPsBulkAdminTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(FloatingIPsBulkAdminTestJSON, cls).setup_clients()
cls.client = cls.os_adm.floating_ips_bulk_client
cls.client = cls.os_admin.floating_ips_bulk_client
@classmethod
def resource_setup(cls):

View File

@ -23,7 +23,7 @@ class HostsAdminTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(HostsAdminTestJSON, cls).setup_clients()
cls.client = cls.os_adm.hosts_client
cls.client = cls.os_admin.hosts_client
@decorators.idempotent_id('9bfaf98d-e2cb-44b0-a07e-2558b2821e4f')
def test_list_hosts(self):

View File

@ -23,8 +23,8 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(HostsAdminNegativeTestJSON, cls).setup_clients()
cls.client = cls.os_adm.hosts_client
cls.non_admin_client = cls.os.hosts_client
cls.client = cls.os_admin.hosts_client
cls.non_admin_client = cls.os_primary.hosts_client
@classmethod
def resource_setup(cls):

View File

@ -23,7 +23,7 @@ class HypervisorAdminTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(HypervisorAdminTestJSON, cls).setup_clients()
cls.client = cls.os_adm.hypervisor_client
cls.client = cls.os_admin.hypervisor_client
def _list_hypervisors(self):
# List of hypervisors

View File

@ -25,7 +25,7 @@ class HypervisorAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(HypervisorAdminNegativeTestJSON, cls).setup_clients()
cls.client = cls.os_adm.hypervisor_client
cls.client = cls.os_admin.hypervisor_client
cls.non_adm_client = cls.hypervisor_client
def _list_hypervisors(self):

View File

@ -26,7 +26,7 @@ class InstanceUsageAuditLogTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(InstanceUsageAuditLogTestJSON, cls).setup_clients()
cls.adm_client = cls.os_adm.instance_usages_audit_log_client
cls.adm_client = cls.os_admin.instance_usages_audit_log_client
@decorators.idempotent_id('25319919-33d9-424f-9f99-2c203ee48b9d')
def test_list_instance_usage_audit_logs(self):

View File

@ -27,7 +27,7 @@ class InstanceUsageAuditLogNegativeTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(InstanceUsageAuditLogNegativeTestJSON, cls).setup_clients()
cls.adm_client = cls.os_adm.instance_usages_audit_log_client
cls.adm_client = cls.os_admin.instance_usages_audit_log_client
@decorators.attr(type=['negative'])
@decorators.idempotent_id('a9d33178-d2c9-4131-ad3b-f4ca8d0308a2')

View File

@ -25,8 +25,8 @@ class KeyPairsV210TestJSON(base.BaseKeypairTest):
@classmethod
def setup_clients(cls):
super(KeyPairsV210TestJSON, cls).setup_clients()
cls.client = cls.os_adm.keypairs_client
cls.non_admin_client = cls.os.keypairs_client
cls.client = cls.os_admin.keypairs_client
cls.non_admin_client = cls.os_primary.keypairs_client
def _create_and_check_keypairs(self, user_id):
key_list = list()

View File

@ -48,8 +48,8 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(LiveBlockMigrationTestJSON, cls).setup_clients()
cls.admin_hosts_client = cls.os_adm.hosts_client
cls.admin_migration_client = cls.os_adm.migrations_client
cls.admin_hosts_client = cls.os_admin.hosts_client
cls.admin_migration_client = cls.os_admin.migrations_client
@classmethod
def _get_compute_hostnames(cls):

View File

@ -29,7 +29,7 @@ class MigrationsAdminTest(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(MigrationsAdminTest, cls).setup_clients()
cls.client = cls.os_adm.migrations_client
cls.client = cls.os_admin.migrations_client
@decorators.idempotent_id('75c0b83d-72a0-4cf8-a153-631e83e7d53f')
def test_list_migrations(self):

View File

@ -30,7 +30,7 @@ class NetworksTest(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(NetworksTest, cls).setup_clients()
cls.client = cls.os_adm.compute_networks_client
cls.client = cls.os_admin.compute_networks_client
@decorators.idempotent_id('d206d211-8912-486f-86e2-a9d090d1f416')
def test_get_network(self):

View File

@ -35,7 +35,7 @@ class QuotasAdminTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(QuotasAdminTestJSON, cls).setup_clients()
cls.adm_client = cls.os_adm.quotas_client
cls.adm_client = cls.os_admin.quotas_client
@classmethod
def resource_setup(cls):
@ -153,7 +153,7 @@ class QuotaClassesAdminTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def resource_setup(cls):
super(QuotaClassesAdminTestJSON, cls).resource_setup()
cls.adm_client = cls.os_adm.quota_classes_client
cls.adm_client = cls.os_admin.quota_classes_client
def _restore_default_quotas(self, original_defaults):
LOG.debug("restoring quota class defaults")

View File

@ -28,8 +28,8 @@ class QuotasAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(QuotasAdminNegativeTestJSON, cls).setup_clients()
cls.client = cls.os.quotas_client
cls.adm_client = cls.os_adm.quotas_client
cls.client = cls.os_primary.quotas_client
cls.adm_client = cls.os_admin.quotas_client
cls.sg_client = cls.security_groups_client
cls.sgr_client = cls.security_group_rules_client

View File

@ -38,7 +38,7 @@ class SecurityGroupDefaultRulesTest(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(SecurityGroupDefaultRulesTest, cls).setup_clients()
cls.adm_client = cls.os_adm.security_group_default_rules_client
cls.adm_client = cls.os_admin.security_group_default_rules_client
def _create_security_group_default_rules(self, ip_protocol='tcp',
from_port=22, to_port=22,

View File

@ -24,7 +24,7 @@ class SecurityGroupsTestAdminJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(SecurityGroupsTestAdminJSON, cls).setup_clients()
cls.adm_client = cls.os_adm.compute_security_groups_client
cls.adm_client = cls.os_admin.compute_security_groups_client
cls.client = cls.security_groups_client
def _delete_security_group(self, securitygroup_id, admin=True):

View File

@ -26,7 +26,7 @@ class ServersAdminTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(ServersAdminTestJSON, cls).setup_clients()
cls.client = cls.os_adm.servers_client
cls.client = cls.os_admin.servers_client
cls.non_admin_client = cls.servers_client
@classmethod

View File

@ -31,9 +31,9 @@ class ServersAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(ServersAdminNegativeTestJSON, cls).setup_clients()
cls.client = cls.os_adm.servers_client
cls.client = cls.os_admin.servers_client
cls.non_adm_client = cls.servers_client
cls.quotas_client = cls.os_adm.quotas_client
cls.quotas_client = cls.os_admin.quotas_client
@classmethod
def resource_setup(cls):

View File

@ -33,7 +33,7 @@ class ServersOnMultiNodesTest(base.BaseV2ComputeAdminTest):
"Less than 2 compute nodes, skipping multi-nodes test.")
def _get_host(self, server_id):
return self.os_adm.servers_client.show_server(
return self.os_admin.servers_client.show_server(
server_id)['server']['OS-EXT-SRV-ATTR:host']
@decorators.idempotent_id('26a9d5df-6890-45f2-abc4-a659290cb130')

View File

@ -24,7 +24,7 @@ class ServicesAdminTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(ServicesAdminTestJSON, cls).setup_clients()
cls.client = cls.os_adm.services_client
cls.client = cls.os_admin.services_client
@decorators.idempotent_id('5be41ef4-53d1-41cc-8839-5c2a48a1b283')
def test_list_services(self):

View File

@ -23,7 +23,7 @@ class ServicesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(ServicesAdminNegativeTestJSON, cls).setup_clients()
cls.client = cls.os_adm.services_client
cls.client = cls.os_admin.services_client
cls.non_admin_client = cls.services_client
@decorators.attr(type=['negative'])

View File

@ -30,8 +30,8 @@ class TenantUsagesTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(TenantUsagesTestJSON, cls).setup_clients()
cls.adm_client = cls.os_adm.tenant_usages_client
cls.client = cls.os.tenant_usages_client
cls.adm_client = cls.os_admin.tenant_usages_client
cls.client = cls.os_primary.tenant_usages_client
@classmethod
def resource_setup(cls):

View File

@ -25,8 +25,8 @@ class TenantUsagesNegativeTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setup_clients(cls):
super(TenantUsagesNegativeTestJSON, cls).setup_clients()
cls.adm_client = cls.os_adm.tenant_usages_client
cls.client = cls.os.tenant_usages_client
cls.adm_client = cls.os_admin.tenant_usages_client
cls.client = cls.os_primary.tenant_usages_client
@classmethod
def resource_setup(cls):

View File

@ -63,38 +63,41 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
@classmethod
def setup_clients(cls):
super(BaseV2ComputeTest, cls).setup_clients()
cls.servers_client = cls.os.servers_client
cls.server_groups_client = cls.os.server_groups_client
cls.flavors_client = cls.os.flavors_client
cls.compute_images_client = cls.os.compute_images_client
cls.extensions_client = cls.os.extensions_client
cls.floating_ip_pools_client = cls.os.floating_ip_pools_client
cls.floating_ips_client = cls.os.compute_floating_ips_client
cls.keypairs_client = cls.os.keypairs_client
cls.servers_client = cls.os_primary.servers_client
cls.server_groups_client = cls.os_primary.server_groups_client
cls.flavors_client = cls.os_primary.flavors_client
cls.compute_images_client = cls.os_primary.compute_images_client
cls.extensions_client = cls.os_primary.extensions_client
cls.floating_ip_pools_client = cls.os_primary.floating_ip_pools_client
cls.floating_ips_client = cls.os_primary.compute_floating_ips_client
cls.keypairs_client = cls.os_primary.keypairs_client
cls.security_group_rules_client = (
cls.os.compute_security_group_rules_client)
cls.security_groups_client = cls.os.compute_security_groups_client
cls.quotas_client = cls.os.quotas_client
cls.compute_networks_client = cls.os.compute_networks_client
cls.limits_client = cls.os.limits_client
cls.volumes_extensions_client = cls.os.volumes_extensions_client
cls.snapshots_extensions_client = cls.os.snapshots_extensions_client
cls.interfaces_client = cls.os.interfaces_client
cls.fixed_ips_client = cls.os.fixed_ips_client
cls.availability_zone_client = cls.os.availability_zone_client
cls.agents_client = cls.os.agents_client
cls.aggregates_client = cls.os.aggregates_client
cls.services_client = cls.os.services_client
cls.os_primary.compute_security_group_rules_client)
cls.security_groups_client =\
cls.os_primary.compute_security_groups_client
cls.quotas_client = cls.os_primary.quotas_client
cls.compute_networks_client = cls.os_primary.compute_networks_client
cls.limits_client = cls.os_primary.limits_client
cls.volumes_extensions_client =\
cls.os_primary.volumes_extensions_client
cls.snapshots_extensions_client =\
cls.os_primary.snapshots_extensions_client
cls.interfaces_client = cls.os_primary.interfaces_client
cls.fixed_ips_client = cls.os_primary.fixed_ips_client
cls.availability_zone_client = cls.os_primary.availability_zone_client
cls.agents_client = cls.os_primary.agents_client
cls.aggregates_client = cls.os_primary.aggregates_client
cls.services_client = cls.os_primary.services_client
cls.instance_usages_audit_log_client = (
cls.os.instance_usages_audit_log_client)
cls.hypervisor_client = cls.os.hypervisor_client
cls.certificates_client = cls.os.certificates_client
cls.migrations_client = cls.os.migrations_client
cls.os_primary.instance_usages_audit_log_client)
cls.hypervisor_client = cls.os_primary.hypervisor_client
cls.certificates_client = cls.os_primary.certificates_client
cls.migrations_client = cls.os_primary.migrations_client
cls.security_group_default_rules_client = (
cls.os.security_group_default_rules_client)
cls.versions_client = cls.os.compute_versions_client
cls.os_primary.security_group_default_rules_client)
cls.versions_client = cls.os_primary.compute_versions_client
cls.volumes_client = cls.os.volumes_v2_client
cls.volumes_client = cls.os_primary.volumes_v2_client
@classmethod
def resource_setup(cls):
@ -470,9 +473,9 @@ class BaseV2ComputeAdminTest(BaseV2ComputeTest):
def setup_clients(cls):
super(BaseV2ComputeAdminTest, cls).setup_clients()
cls.availability_zone_admin_client = (
cls.os_adm.availability_zone_client)
cls.admin_flavors_client = cls.os_adm.flavors_client
cls.admin_servers_client = cls.os_adm.servers_client
cls.os_admin.availability_zone_client)
cls.admin_flavors_client = cls.os_admin.flavors_client
cls.admin_servers_client = cls.os_admin.servers_client
def create_flavor(self, ram, vcpus, disk, name=None,
is_public='True', **kwargs):

View File

@ -34,9 +34,9 @@ class FlavorsV2NegativeTest(base.BaseV2ComputeTest):
def setup_clients(cls):
super(FlavorsV2NegativeTest, cls).setup_clients()
if CONF.image_feature_enabled.api_v1:
cls.images_client = cls.os.image_client
cls.images_client = cls.os_primary.image_client
elif CONF.image_feature_enabled.api_v2:
cls.images_client = cls.os.image_client_v2
cls.images_client = cls.os_primary.image_client_v2
else:
raise lib_exc.InvalidConfiguration(
'Either api_v1 or api_v2 must be True in '

View File

@ -42,9 +42,9 @@ class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
# prefer glance v1 for the compute API tests since the compute image
# API proxy was written for glance v1.
if CONF.image_feature_enabled.api_v1:
cls.glance_client = cls.os.image_client
cls.glance_client = cls.os_primary.image_client
elif CONF.image_feature_enabled.api_v2:
cls.glance_client = cls.os.image_client_v2
cls.glance_client = cls.os_primary.image_client_v2
else:
raise exceptions.InvalidConfiguration(
'Either api_v1 or api_v2 must be True in '

View File

@ -46,9 +46,9 @@ class ListImageFiltersTestJSON(base.BaseV2ComputeTest):
# prefer glance v1 for the compute API tests since the compute image
# API proxy was written for glance v1.
if CONF.image_feature_enabled.api_v1:
cls.glance_client = cls.os.image_client
cls.glance_client = cls.os_primary.image_client
elif CONF.image_feature_enabled.api_v2:
cls.glance_client = cls.os.image_client_v2
cls.glance_client = cls.os_primary.image_client_v2
else:
raise exceptions.InvalidConfiguration(
'Either api_v1 or api_v2 must be True in '

View File

@ -46,8 +46,8 @@ class AttachInterfacesTestJSON(base.BaseV2ComputeTest):
@classmethod
def setup_clients(cls):
super(AttachInterfacesTestJSON, cls).setup_clients()
cls.subnets_client = cls.os.subnets_client
cls.ports_client = cls.os.ports_client
cls.subnets_client = cls.os_primary.subnets_client
cls.ports_client = cls.os_primary.ports_client
# TODO(mriedem): move this into a common waiters utility module
def wait_for_port_detach(self, port_id):
@ -231,7 +231,7 @@ class AttachInterfacesTestJSON(base.BaseV2ComputeTest):
network_id = ifs[0]['net_id']
self.servers_client.add_fixed_ip(server['id'], networkId=network_id)
# Remove the fixed IP from server.
server_detail = self.os.servers_client.show_server(
server_detail = self.os_primary.servers_client.show_server(
server['id'])['server']
# Get the Fixed IP from server.
fixed_ip = None

View File

@ -38,8 +38,8 @@ class ServersTestJSON(base.BaseV2ComputeTest):
def setup_clients(cls):
super(ServersTestJSON, cls).setup_clients()
cls.client = cls.servers_client
cls.networks_client = cls.os.networks_client
cls.subnets_client = cls.os.subnets_client
cls.networks_client = cls.os_primary.networks_client
cls.subnets_client = cls.os_primary.subnets_client
@classmethod
def resource_setup(cls):

View File

@ -55,10 +55,10 @@ class DeviceTaggingTest(base.BaseV2ComputeTest):
@classmethod
def setup_clients(cls):
super(DeviceTaggingTest, cls).setup_clients()
cls.networks_client = cls.os.networks_client
cls.ports_client = cls.os.ports_client
cls.subnets_client = cls.os.subnets_client
cls.interfaces_client = cls.os.interfaces_client
cls.networks_client = cls.os_primary.networks_client
cls.ports_client = cls.os_primary.ports_client
cls.subnets_client = cls.os_primary.subnets_client
cls.interfaces_client = cls.os_primary.interfaces_client
@classmethod
def setup_credentials(cls):

View File

@ -35,7 +35,7 @@ class ServerDiskConfigTestJSON(base.BaseV2ComputeTest):
@classmethod
def setup_clients(cls):
super(ServerDiskConfigTestJSON, cls).setup_clients()
cls.client = cls.os.servers_client
cls.client = cls.os_primary.servers_client
def _update_server_with_disk_config(self, server_id, disk_config):
server = self.client.show_server(server_id)['server']

View File

@ -337,9 +337,9 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest):
# prefer glance v1 for the compute API tests since the compute image
# API proxy was written for glance v1.
if CONF.image_feature_enabled.api_v1:
glance_client = self.os.image_client
glance_client = self.os_primary.image_client
elif CONF.image_feature_enabled.api_v2:
glance_client = self.os.image_client_v2
glance_client = self.os_primary.image_client_v2
else:
raise lib_exc.InvalidConfiguration(
'Either api_v1 or api_v2 must be True in '

View File

@ -29,7 +29,7 @@ class ComputeNetworksTest(base.BaseV2ComputeTest):
@classmethod
def setup_clients(cls):
super(ComputeNetworksTest, cls).setup_clients()
cls.client = cls.os.compute_networks_client
cls.client = cls.os_primary.compute_networks_client
@decorators.idempotent_id('3fe07175-312e-49a5-a623-5f52eeada4c2')
def test_list_networks(self):

View File

@ -22,7 +22,7 @@ class ComputeTenantNetworksTest(base.BaseV2ComputeTest):
@classmethod
def resource_setup(cls):
super(ComputeTenantNetworksTest, cls).resource_setup()
cls.client = cls.os.tenant_networks_client
cls.client = cls.os_primary.tenant_networks_client
cls.network = cls.get_tenant_network()
@classmethod

View File

@ -146,7 +146,7 @@ class TokensV3TestJSON(base.BaseIdentityV3AdminTest):
@decorators.idempotent_id('08ed85ce-2ba8-4864-b442-bcc61f16ae89')
def test_get_available_project_scopes(self):
manager_project_id = self.manager.credentials.project_id
admin_user_id = self.os_adm.credentials.user_id
admin_user_id = self.os_admin.credentials.user_id
admin_role_id = self.get_role_by_name(CONF.identity.admin_role)['id']
# Grant the user the role on both projects.
@ -156,7 +156,7 @@ class TokensV3TestJSON(base.BaseIdentityV3AdminTest):
self.roles_client.delete_role_from_user_on_project,
manager_project_id, admin_user_id, admin_role_id)
assigned_project_ids = [self.os_adm.credentials.project_id,
assigned_project_ids = [self.os_admin.credentials.project_id,
manager_project_id]
# Get available project scopes

View File

@ -278,9 +278,9 @@ class TrustsV3TestJSON(BaseTrustsV3Test):
# Listing trusts can be done by trustor, by trustee, or without
# any filter if scoped to a project, so we must ensure token scope is
# project for this test.
original_scope = self.os_adm.auth_provider.scope
set_scope(self.os_adm.auth_provider, 'project')
self.addCleanup(set_scope, self.os_adm.auth_provider, original_scope)
original_scope = self.os_admin.auth_provider.scope
set_scope(self.os_admin.auth_provider, 'project')
self.addCleanup(set_scope, self.os_admin.auth_provider, original_scope)
trusts_get = self.trusts_client.list_trusts()['trusts']
trusts = [t for t in trusts_get
if t['id'] == self.trust_id]

View File

@ -147,8 +147,8 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
'Security compliance not available.')
@decorators.idempotent_id('568cd46c-ee6c-4ab4-a33a-d3791931979e')
def test_password_history_not_enforced_in_admin_reset(self):
old_password = self.os.credentials.password
user_id = self.os.credentials.user_id
old_password = self.os_primary.credentials.password
user_id = self.os_primary.credentials.user_id
new_password = data_utils.rand_password()
self.users_client.update_user(user_id, password=new_password)

View File

@ -107,10 +107,10 @@ class BaseIdentityV2Test(BaseIdentityTest):
@classmethod
def setup_clients(cls):
super(BaseIdentityV2Test, cls).setup_clients()
cls.non_admin_client = cls.os.identity_public_client
cls.non_admin_token_client = cls.os.token_client
cls.non_admin_tenants_client = cls.os.tenants_public_client
cls.non_admin_users_client = cls.os.users_public_client
cls.non_admin_client = cls.os_primary.identity_public_client
cls.non_admin_token_client = cls.os_primary.token_client
cls.non_admin_tenants_client = cls.os_primary.tenants_public_client
cls.non_admin_users_client = cls.os_primary.users_public_client
class BaseIdentityV2AdminTest(BaseIdentityV2Test):
@ -135,17 +135,17 @@ class BaseIdentityV2AdminTest(BaseIdentityV2Test):
@classmethod
def setup_clients(cls):
super(BaseIdentityV2AdminTest, cls).setup_clients()
cls.client = cls.os_adm.identity_client
cls.non_admin_client = cls.os.identity_client
cls.token_client = cls.os_adm.token_client
cls.tenants_client = cls.os_adm.tenants_client
cls.non_admin_tenants_client = cls.os.tenants_client
cls.roles_client = cls.os_adm.roles_client
cls.non_admin_roles_client = cls.os.roles_client
cls.users_client = cls.os_adm.users_client
cls.non_admin_users_client = cls.os.users_client
cls.services_client = cls.os_adm.identity_services_client
cls.endpoints_client = cls.os_adm.endpoints_client
cls.client = cls.os_admin.identity_client
cls.non_admin_client = cls.os_primary.identity_client
cls.token_client = cls.os_admin.token_client
cls.tenants_client = cls.os_admin.tenants_client
cls.non_admin_tenants_client = cls.os_primary.tenants_client
cls.roles_client = cls.os_admin.roles_client
cls.non_admin_roles_client = cls.os_primary.roles_client
cls.users_client = cls.os_admin.users_client
cls.non_admin_users_client = cls.os_primary.users_client
cls.services_client = cls.os_admin.identity_services_client
cls.endpoints_client = cls.os_admin.endpoints_client
@classmethod
def resource_setup(cls):
@ -183,11 +183,12 @@ class BaseIdentityV3Test(BaseIdentityTest):
@classmethod
def setup_clients(cls):
super(BaseIdentityV3Test, cls).setup_clients()
cls.non_admin_client = cls.os.identity_v3_client
cls.non_admin_users_client = cls.os.users_v3_client
cls.non_admin_token = cls.os.token_v3_client
cls.non_admin_projects_client = cls.os.projects_client
cls.non_admin_versions_client = cls.os.identity_versions_v3_client
cls.non_admin_client = cls.os_primary.identity_v3_client
cls.non_admin_users_client = cls.os_primary.users_v3_client
cls.non_admin_token = cls.os_primary.token_v3_client
cls.non_admin_projects_client = cls.os_primary.projects_client
cls.non_admin_versions_client =\
cls.os_primary.identity_versions_v3_client
class BaseIdentityV3AdminTest(BaseIdentityV3Test):
@ -206,30 +207,31 @@ class BaseIdentityV3AdminTest(BaseIdentityV3Test):
@classmethod
def setup_clients(cls):
super(BaseIdentityV3AdminTest, cls).setup_clients()
cls.client = cls.os_adm.identity_v3_client
cls.domains_client = cls.os_adm.domains_client
cls.users_client = cls.os_adm.users_v3_client
cls.trusts_client = cls.os_adm.trusts_client
cls.roles_client = cls.os_adm.roles_v3_client
cls.inherited_roles_client = cls.os_adm.inherited_roles_client
cls.token = cls.os_adm.token_v3_client
cls.endpoints_client = cls.os_adm.endpoints_v3_client
cls.regions_client = cls.os_adm.regions_client
cls.services_client = cls.os_adm.identity_services_v3_client
cls.policies_client = cls.os_adm.policies_client
cls.creds_client = cls.os_adm.credentials_client
cls.groups_client = cls.os_adm.groups_client
cls.projects_client = cls.os_adm.projects_client
cls.client = cls.os_admin.identity_v3_client
cls.domains_client = cls.os_admin.domains_client
cls.users_client = cls.os_admin.users_v3_client
cls.trusts_client = cls.os_admin.trusts_client
cls.roles_client = cls.os_admin.roles_v3_client
cls.inherited_roles_client = cls.os_admin.inherited_roles_client
cls.token = cls.os_admin.token_v3_client
cls.endpoints_client = cls.os_admin.endpoints_v3_client
cls.regions_client = cls.os_admin.regions_client
cls.services_client = cls.os_admin.identity_services_v3_client
cls.policies_client = cls.os_admin.policies_client
cls.creds_client = cls.os_admin.credentials_client
cls.groups_client = cls.os_admin.groups_client
cls.projects_client = cls.os_admin.projects_client
cls.role_assignments = cls.os_admin.role_assignments_client
cls.oauth_consumers_client = cls.os_adm.oauth_consumers_client
cls.domain_config_client = cls.os_adm.domain_config_client
cls.endpoint_filter_client = cls.os_adm.endpoint_filter_client
cls.oauth_consumers_client = cls.os_admin.oauth_consumers_client
cls.domain_config_client = cls.os_admin.domain_config_client
cls.endpoint_filter_client = cls.os_admin.endpoint_filter_client
if CONF.identity.admin_domain_scope:
# NOTE(andreaf) When keystone policy requires it, the identity
# admin clients for these tests shall use 'domain' scoped tokens.
# As the client manager is already created by the base class,
# we set the scope for the inner auth provider.
cls.os_adm.auth_provider.scope = 'domain'
cls.os_admin.auth_provider.scope = 'domain'
@classmethod
def disable_user(cls, user_name, domain_id=None):

View File

@ -31,7 +31,7 @@ class EC2CredentialsTest(base.BaseIdentityV2Test):
@classmethod
def resource_setup(cls):
super(EC2CredentialsTest, cls).resource_setup()
cls.creds = cls.os.credentials
cls.creds = cls.os_primary.credentials
@decorators.idempotent_id('b580fab9-7ae9-46e8-8138-417260cb6f9f')
def test_create_ec2_credential(self):

View File

@ -24,7 +24,7 @@ class IdentityTenantsTest(base.BaseIdentityV2Test):
@decorators.idempotent_id('ecae2459-243d-4ba1-ad02-65f15dc82b78')
def test_list_tenants_returns_only_authorized_tenants(self):
alt_tenant_name = self.alt_manager.credentials.tenant_name
alt_tenant_name = self.os_alt.credentials.tenant_name
resp = self.non_admin_tenants_client.list_tenants()
# check that user can see only that tenants that he presents in so user
@ -32,18 +32,19 @@ class IdentityTenantsTest(base.BaseIdentityV2Test):
# from received tenants list
for tenant in resp['tenants']:
body = self.non_admin_token_client.auth(
self.os.credentials.username,
self.os.credentials.password,
self.os_primary.credentials.username,
self.os_primary.credentials.password,
tenant['name'])
self.assertNotEmpty(body['token']['id'])
self.assertEqual(body['token']['tenant']['id'], tenant['id'])
self.assertEqual(body['token']['tenant']['name'], tenant['name'])
self.assertEqual(body['user']['id'], self.os.credentials.user_id)
self.assertEqual(
body['user']['id'], self.os_primary.credentials.user_id)
# check that user cannot log in to alt user's tenant
self.assertRaises(
lib_exc.Unauthorized,
self.non_admin_token_client.auth,
self.os.credentials.username,
self.os.credentials.password,
self.os_primary.credentials.username,
self.os_primary.credentials.password,
alt_tenant_name)

View File

@ -27,7 +27,7 @@ class TokensTest(base.BaseIdentityV2Test):
token_client = self.non_admin_token_client
# get a token for the user
creds = self.os.credentials
creds = self.os_primary.credentials
username = creds.username
password = creds.password
tenant_name = creds.tenant_name

View File

@ -30,7 +30,7 @@ class IdentityUsersTest(base.BaseIdentityV2Test):
@classmethod
def resource_setup(cls):
super(IdentityUsersTest, cls).resource_setup()
cls.creds = cls.os.credentials
cls.creds = cls.os_primary.credentials
cls.username = cls.creds.username
cls.password = cls.creds.password
cls.tenant_name = cls.creds.tenant_name

View File

@ -25,9 +25,9 @@ class IdentityV3ProjectsTest(base.BaseIdentityV3Test):
@decorators.idempotent_id('86128d46-e170-4644-866a-cc487f699e1d')
def test_list_projects_returns_only_authorized_projects(self):
alt_project_name =\
self.alt_manager.credentials.project_name
self.os_alt.credentials.project_name
resp = self.non_admin_users_client.list_user_projects(
self.os.credentials.user_id)
self.os_primary.credentials.user_id)
# check that user can see only that projects that he presents in so
# user can successfully authenticate using his credentials and
@ -36,23 +36,24 @@ class IdentityV3ProjectsTest(base.BaseIdentityV3Test):
# 'user_domain_id' needs to be specified otherwise tempest.lib
# assumes it to be 'default'
token_id, body = self.non_admin_token.get_token(
username=self.os.credentials.username,
user_domain_id=self.os.credentials.user_domain_id,
password=self.os.credentials.password,
username=self.os_primary.credentials.username,
user_domain_id=self.os_primary.credentials.user_domain_id,
password=self.os_primary.credentials.password,
project_name=project['name'],
project_domain_id=project['domain_id'],
auth_data=True)
self.assertNotEmpty(token_id)
self.assertEqual(body['project']['id'], project['id'])
self.assertEqual(body['project']['name'], project['name'])
self.assertEqual(body['user']['id'], self.os.credentials.user_id)
self.assertEqual(
body['user']['id'], self.os_primary.credentials.user_id)
# check that user cannot log in to alt user's project
self.assertRaises(
lib_exc.Unauthorized,
self.non_admin_token.get_token,
username=self.os.credentials.username,
user_domain_id=self.os.credentials.user_domain_id,
password=self.os.credentials.password,
username=self.os_primary.credentials.username,
user_domain_id=self.os_primary.credentials.user_domain_id,
password=self.os_primary.credentials.password,
project_name=alt_project_name,
project_domain_id=project['domain_id'])

View File

@ -24,7 +24,7 @@ class TokensV3Test(base.BaseIdentityV3Test):
@decorators.idempotent_id('6f8e4436-fc96-4282-8122-e41df57197a9')
def test_create_token(self):
creds = self.os.credentials
creds = self.os_primary.credentials
user_id = creds.user_id
username = creds.username
password = creds.password

View File

@ -32,7 +32,7 @@ class IdentityV3UsersTest(base.BaseIdentityV3Test):
@classmethod
def resource_setup(cls):
super(IdentityV3UsersTest, cls).resource_setup()
cls.creds = cls.os.credentials
cls.creds = cls.os_primary.credentials
cls.user_id = cls.creds.user_id
def _update_password(self, original_password, password):

View File

@ -94,7 +94,7 @@ class BaseV1ImageTest(BaseImageTest):
@classmethod
def setup_clients(cls):
super(BaseV1ImageTest, cls).setup_clients()
cls.client = cls.os.image_client
cls.client = cls.os_primary.image_client
@classmethod
def _get_create_params(cls, **kwargs):
@ -108,7 +108,7 @@ class BaseV1ImageMembersTest(BaseV1ImageTest):
@classmethod
def setup_clients(cls):
super(BaseV1ImageMembersTest, cls).setup_clients()
cls.image_member_client = cls.os.image_member_client
cls.image_member_client = cls.os_primary.image_member_client
cls.alt_image_member_client = cls.os_alt.image_member_client
cls.alt_img_cli = cls.os_alt.image_client
@ -138,14 +138,15 @@ class BaseV2ImageTest(BaseImageTest):
@classmethod
def setup_clients(cls):
super(BaseV2ImageTest, cls).setup_clients()
cls.client = cls.os.image_client_v2
cls.namespaces_client = cls.os.namespaces_client
cls.resource_types_client = cls.os.resource_types_client
cls.namespace_properties_client = cls.os.namespace_properties_client
cls.namespace_objects_client = cls.os.namespace_objects_client
cls.namespace_tags_client = cls.os.namespace_tags_client
cls.schemas_client = cls.os.schemas_client
cls.versions_client = cls.os.image_versions_client
cls.client = cls.os_primary.image_client_v2
cls.namespaces_client = cls.os_primary.namespaces_client
cls.resource_types_client = cls.os_primary.resource_types_client
cls.namespace_properties_client =\
cls.os_primary.namespace_properties_client
cls.namespace_objects_client = cls.os_primary.namespace_objects_client
cls.namespace_tags_client = cls.os_primary.namespace_tags_client
cls.schemas_client = cls.os_primary.schemas_client
cls.versions_client = cls.os_primary.image_versions_client
def create_namespace(cls, namespace_name=None, visibility='public',
description='Tempest', protected=False,
@ -167,7 +168,7 @@ class BaseV2MemberImageTest(BaseV2ImageTest):
@classmethod
def setup_clients(cls):
super(BaseV2MemberImageTest, cls).setup_clients()
cls.image_member_client = cls.os.image_member_client_v2
cls.image_member_client = cls.os_primary.image_member_client_v2
cls.alt_image_member_client = cls.os_alt.image_member_client_v2
cls.alt_img_client = cls.os_alt.image_client_v2
@ -196,8 +197,8 @@ class BaseV1ImageAdminTest(BaseImageTest):
@classmethod
def setup_clients(cls):
super(BaseV1ImageAdminTest, cls).setup_clients()
cls.client = cls.os.image_client
cls.admin_client = cls.os_adm.image_client
cls.client = cls.os_primary.image_client
cls.admin_client = cls.os_admin.image_client
class BaseV2ImageAdminTest(BaseImageTest):
@ -206,5 +207,5 @@ class BaseV2ImageAdminTest(BaseImageTest):
@classmethod
def setup_clients(cls):
super(BaseV2ImageAdminTest, cls).setup_clients()
cls.client = cls.os.image_client_v2
cls.admin_client = cls.os_adm.image_client_v2
cls.client = cls.os_primary.image_client_v2
cls.admin_client = cls.os_admin.image_client_v2

View File

@ -364,7 +364,7 @@ class ListSharedImagesTest(base.BaseV2ImageTest):
@classmethod
def setup_clients(cls):
super(ListSharedImagesTest, cls).setup_clients()
cls.image_member_client = cls.os.image_member_client_v2
cls.image_member_client = cls.os_primary.image_member_client_v2
cls.alt_img_client = cls.os_alt.image_client_v2
@decorators.idempotent_id('3fa50be4-8e38-4c02-a8db-7811bb780122')

View File

@ -38,7 +38,7 @@ class FloatingIPAdminTestJSON(base.BaseAdminNetworkTest):
@classmethod
def setup_clients(cls):
super(FloatingIPAdminTestJSON, cls).setup_clients()
cls.alt_floating_ips_client = cls.alt_manager.floating_ips_client
cls.alt_floating_ips_client = cls.os_alt.floating_ips_client
@classmethod
def resource_setup(cls):

View File

@ -68,20 +68,21 @@ class BaseNetworkTest(tempest.test.BaseTestCase):
@classmethod
def setup_clients(cls):
super(BaseNetworkTest, cls).setup_clients()
cls.agents_client = cls.os.network_agents_client
cls.network_extensions_client = cls.os.network_extensions_client
cls.networks_client = cls.os.networks_client
cls.routers_client = cls.os.routers_client
cls.subnetpools_client = cls.os.subnetpools_client
cls.subnets_client = cls.os.subnets_client
cls.ports_client = cls.os.ports_client
cls.quotas_client = cls.os.network_quotas_client
cls.floating_ips_client = cls.os.floating_ips_client
cls.security_groups_client = cls.os.security_groups_client
cls.agents_client = cls.os_primary.network_agents_client
cls.network_extensions_client =\
cls.os_primary.network_extensions_client
cls.networks_client = cls.os_primary.networks_client
cls.routers_client = cls.os_primary.routers_client
cls.subnetpools_client = cls.os_primary.subnetpools_client
cls.subnets_client = cls.os_primary.subnets_client
cls.ports_client = cls.os_primary.ports_client
cls.quotas_client = cls.os_primary.network_quotas_client
cls.floating_ips_client = cls.os_primary.floating_ips_client
cls.security_groups_client = cls.os_primary.security_groups_client
cls.security_group_rules_client = (
cls.os.security_group_rules_client)
cls.network_versions_client = cls.os.network_versions_client
cls.service_providers_client = cls.os.service_providers_client
cls.os_primary.security_group_rules_client)
cls.network_versions_client = cls.os_primary.network_versions_client
cls.service_providers_client = cls.os_primary.service_providers_client
@classmethod
def resource_setup(cls):
@ -258,16 +259,16 @@ class BaseAdminNetworkTest(BaseNetworkTest):
@classmethod
def setup_clients(cls):
super(BaseAdminNetworkTest, cls).setup_clients()
cls.admin_agents_client = cls.os_adm.network_agents_client
cls.admin_networks_client = cls.os_adm.networks_client
cls.admin_routers_client = cls.os_adm.routers_client
cls.admin_subnets_client = cls.os_adm.subnets_client
cls.admin_ports_client = cls.os_adm.ports_client
cls.admin_quotas_client = cls.os_adm.network_quotas_client
cls.admin_floating_ips_client = cls.os_adm.floating_ips_client
cls.admin_metering_labels_client = cls.os_adm.metering_labels_client
cls.admin_agents_client = cls.os_admin.network_agents_client
cls.admin_networks_client = cls.os_admin.networks_client
cls.admin_routers_client = cls.os_admin.routers_client
cls.admin_subnets_client = cls.os_admin.subnets_client
cls.admin_ports_client = cls.os_admin.ports_client
cls.admin_quotas_client = cls.os_admin.network_quotas_client
cls.admin_floating_ips_client = cls.os_admin.floating_ips_client
cls.admin_metering_labels_client = cls.os_admin.metering_labels_client
cls.admin_metering_label_rules_client = (
cls.os_adm.metering_label_rules_client)
cls.os_admin.metering_label_rules_client)
@classmethod
def create_metering_label(cls, name, description):

View File

@ -79,11 +79,11 @@ class BaseObjectTest(tempest.test.BaseTestCase):
@classmethod
def setup_clients(cls):
super(BaseObjectTest, cls).setup_clients()
cls.object_client = cls.os.object_client
cls.bulk_client = cls.os.bulk_client
cls.container_client = cls.os.container_client
cls.account_client = cls.os.account_client
cls.capabilities_client = cls.os.capabilities_client
cls.object_client = cls.os_roles_operator.object_client
cls.bulk_client = cls.os_roles_operator.bulk_client
cls.container_client = cls.os_roles_operator.container_client
cls.account_client = cls.os_roles_operator.account_client
cls.capabilities_client = cls.os_roles_operator.capabilities_client
@classmethod
def resource_setup(cls):

View File

@ -54,8 +54,8 @@ class AccountQuotasTest(base.BaseObjectTest):
# Set a quota of 20 bytes on the user's account before each test
headers = {"X-Account-Meta-Quota-Bytes": "20"}
self.os.account_client.request("POST", url="", headers=headers,
body="")
self.os_roles_operator.account_client.request(
"POST", url="", headers=headers, body="")
def tearDown(self):
# Set the reselleradmin auth in headers for next account_client
@ -67,8 +67,8 @@ class AccountQuotasTest(base.BaseObjectTest):
# remove the quota from the container
headers = {"X-Remove-Account-Meta-Quota-Bytes": "x"}
self.os.account_client.request("POST", url="", headers=headers,
body="")
self.os_roles_operator.account_client.request(
"POST", url="", headers=headers, body="")
super(AccountQuotasTest, self).tearDown()
@classmethod
@ -108,9 +108,8 @@ class AccountQuotasTest(base.BaseObjectTest):
)
headers = {"X-Account-Meta-Quota-Bytes": quota}
resp, _ = self.os.account_client.request("POST", url="",
headers=headers,
body="")
resp, _ = self.os_roles_operator.account_client.request(
"POST", url="", headers=headers, body="")
self.assertEqual(resp["status"], "204")
self.assertHeaders(resp, 'Account', 'POST')

View File

@ -53,8 +53,8 @@ class AccountQuotasNegativeTest(base.BaseObjectTest):
# Set a quota of 20 bytes on the user's account before each test
headers = {"X-Account-Meta-Quota-Bytes": "20"}
self.os.account_client.request("POST", url="", headers=headers,
body="")
self.os_roles_operator.account_client.request(
"POST", url="", headers=headers, body="")
def tearDown(self):
# Set the reselleradmin auth in headers for next account_client
@ -66,8 +66,8 @@ class AccountQuotasNegativeTest(base.BaseObjectTest):
# remove the quota from the container
headers = {"X-Remove-Account-Meta-Quota-Bytes": "x"}
self.os.account_client.request("POST", url="", headers=headers,
body="")
self.os_roles_operator.account_client.request(
"POST", url="", headers=headers, body="")
super(AccountQuotasNegativeTest, self).tearDown()
@classmethod

View File

@ -42,13 +42,13 @@ class BaseOrchestrationTest(tempest.test.BaseTestCase):
@classmethod
def setup_clients(cls):
super(BaseOrchestrationTest, cls).setup_clients()
cls.orchestration_client = cls.os.orchestration_client
cls.orchestration_client = cls.os_primary.orchestration_client
cls.client = cls.orchestration_client
cls.servers_client = cls.os.servers_client
cls.keypairs_client = cls.os.keypairs_client
cls.networks_client = cls.os.networks_client
cls.images_v2_client = cls.os.image_client_v2
cls.volumes_client = cls.os.volumes_v2_client
cls.servers_client = cls.os_primary.servers_client
cls.keypairs_client = cls.os_primary.keypairs_client
cls.networks_client = cls.os_primary.networks_client
cls.images_v2_client = cls.os_primary.image_client_v2
cls.volumes_client = cls.os_primary.volumes_v2_client
@classmethod
def resource_setup(cls):

View File

@ -41,9 +41,9 @@ class NeutronResourcesTestJSON(base.BaseOrchestrationTest):
@classmethod
def setup_clients(cls):
super(NeutronResourcesTestJSON, cls).setup_clients()
cls.subnets_client = cls.os.subnets_client
cls.ports_client = cls.os.ports_client
cls.routers_client = cls.os.routers_client
cls.subnets_client = cls.os_primary.subnets_client
cls.ports_client = cls.os_primary.ports_client
cls.routers_client = cls.os_primary.routers_client
@classmethod
def resource_setup(cls):

View File

@ -40,8 +40,8 @@ class SwiftResourcesTestJSON(base.BaseOrchestrationTest):
@classmethod
def setup_clients(cls):
super(SwiftResourcesTestJSON, cls).setup_clients()
cls.account_client = cls.os.account_client
cls.container_client = cls.os.container_client
cls.account_client = cls.os_primary.account_client
cls.container_client = cls.os_primary.container_client
@classmethod
def resource_setup(cls):

View File

@ -35,13 +35,13 @@ class BaseVolumeQuotasAdminTestJSON(base.BaseVolumeAdminTest):
@classmethod
def setup_credentials(cls):
super(BaseVolumeQuotasAdminTestJSON, cls).setup_credentials()
cls.demo_tenant_id = cls.os.credentials.tenant_id
cls.demo_tenant_id = cls.os_primary.credentials.tenant_id
cls.alt_client = cls.os_alt.volumes_client
@classmethod
def setup_clients(cls):
super(BaseVolumeQuotasAdminTestJSON, cls).setup_clients()
cls.transfer_client = cls.os.volume_transfers_v2_client
cls.transfer_client = cls.os_primary.volume_transfers_v2_client
cls.alt_transfer_client = cls.os_alt.volume_transfers_v2_client
@decorators.idempotent_id('59eada70-403c-4cef-a2a3-a8ce2f1b07a0')
@ -86,7 +86,7 @@ class BaseVolumeQuotasAdminTestJSON(base.BaseVolumeAdminTest):
@decorators.idempotent_id('18c51ae9-cb03-48fc-b234-14a19374dbed')
def test_show_quota_usage(self):
quota_usage = self.admin_quotas_client.show_quota_set(
self.os_adm.credentials.tenant_id,
self.os_admin.credentials.tenant_id,
params={'usage': True})['quota_set']
for key in QUOTA_KEYS:
self.assertIn(key, quota_usage)

View File

@ -27,7 +27,7 @@ class BaseVolumeQuotasNegativeTestJSON(base.BaseVolumeAdminTest):
@classmethod
def setup_credentials(cls):
super(BaseVolumeQuotasNegativeTestJSON, cls).setup_credentials()
cls.demo_tenant_id = cls.os.credentials.tenant_id
cls.demo_tenant_id = cls.os_primary.credentials.tenant_id
@classmethod
def resource_setup(cls):

View File

@ -33,7 +33,7 @@ class VolumeSnapshotQuotasNegativeTestJSON(base.BaseVolumeAdminTest):
@classmethod
def setup_credentials(cls):
super(VolumeSnapshotQuotasNegativeTestJSON, cls).setup_credentials()
cls.demo_tenant_id = cls.os.credentials.tenant_id
cls.demo_tenant_id = cls.os_primary.credentials.tenant_id
@classmethod
def resource_setup(cls):

View File

@ -64,20 +64,21 @@ class BaseVolumeTest(api_version_utils.BaseMicroversionTest,
@classmethod
def setup_clients(cls):
super(BaseVolumeTest, cls).setup_clients()
cls.servers_client = cls.os.servers_client
cls.servers_client = cls.os_primary.servers_client
if CONF.service_available.glance:
cls.images_client = cls.os.image_client_v2
cls.images_client = cls.os_primary.image_client_v2
cls.snapshots_client = cls.os.snapshots_v2_client
cls.volumes_client = cls.os.volumes_v2_client
cls.backups_client = cls.os.backups_v2_client
cls.volumes_extension_client = cls.os.volumes_v2_extension_client
cls.snapshots_client = cls.os_primary.snapshots_v2_client
cls.volumes_client = cls.os_primary.volumes_v2_client
cls.backups_client = cls.os_primary.backups_v2_client
cls.volumes_extension_client =\
cls.os_primary.volumes_v2_extension_client
cls.availability_zone_client = (
cls.os.volume_v2_availability_zone_client)
cls.volume_limits_client = cls.os.volume_v2_limits_client
cls.messages_client = cls.os.volume_v3_messages_client
cls.versions_client = cls.os.volume_v3_versions_client
cls.os_primary.volume_v2_availability_zone_client)
cls.volume_limits_client = cls.os_primary.volume_v2_limits_client
cls.messages_client = cls.os_primary.volume_v3_messages_client
cls.versions_client = cls.os_primary.volume_v3_versions_client
def setUp(self):
super(BaseVolumeTest, self).setUp()
@ -246,29 +247,29 @@ class BaseVolumeAdminTest(BaseVolumeTest):
def setup_clients(cls):
super(BaseVolumeAdminTest, cls).setup_clients()
cls.admin_volume_qos_client = cls.os_adm.volume_qos_v2_client
cls.admin_volume_qos_client = cls.os_admin.volume_qos_v2_client
cls.admin_volume_services_client = \
cls.os_adm.volume_services_v2_client
cls.admin_volume_types_client = cls.os_adm.volume_types_v2_client
cls.admin_volume_manage_client = cls.os_adm.volume_manage_v2_client
cls.admin_volume_client = cls.os_adm.volumes_v2_client
cls.admin_hosts_client = cls.os_adm.volume_hosts_v2_client
cls.os_admin.volume_services_v2_client
cls.admin_volume_types_client = cls.os_admin.volume_types_v2_client
cls.admin_volume_manage_client = cls.os_admin.volume_manage_v2_client
cls.admin_volume_client = cls.os_admin.volumes_v2_client
cls.admin_hosts_client = cls.os_admin.volume_hosts_v2_client
cls.admin_snapshot_manage_client = \
cls.os_adm.snapshot_manage_v2_client
cls.admin_snapshots_client = cls.os_adm.snapshots_v2_client
cls.admin_backups_client = cls.os_adm.backups_v2_client
cls.os_admin.snapshot_manage_v2_client
cls.admin_snapshots_client = cls.os_admin.snapshots_v2_client
cls.admin_backups_client = cls.os_admin.backups_v2_client
cls.admin_encryption_types_client = \
cls.os_adm.encryption_types_v2_client
cls.os_admin.encryption_types_v2_client
cls.admin_quota_classes_client = \
cls.os_adm.volume_quota_classes_v2_client
cls.admin_quotas_client = cls.os_adm.volume_quotas_v2_client
cls.admin_volume_limits_client = cls.os_adm.volume_v2_limits_client
cls.os_admin.volume_quota_classes_v2_client
cls.admin_quotas_client = cls.os_admin.volume_quotas_v2_client
cls.admin_volume_limits_client = cls.os_admin.volume_v2_limits_client
cls.admin_capabilities_client = \
cls.os_adm.volume_capabilities_v2_client
cls.os_admin.volume_capabilities_v2_client
cls.admin_scheduler_stats_client = \
cls.os_adm.volume_scheduler_stats_v2_client
cls.admin_messages_client = cls.os_adm.volume_v3_messages_client
cls.admin_volume_types_client = cls.os_adm.volume_types_v2_client
cls.os_admin.volume_scheduler_stats_v2_client
cls.admin_messages_client = cls.os_admin.volume_v3_messages_client
cls.admin_volume_types_client = cls.os_admin.volume_types_v2_client
@classmethod
def resource_setup(cls):

View File

@ -28,10 +28,10 @@ class VolumesTransfersTest(base.BaseVolumeTest):
def setup_clients(cls):
super(VolumesTransfersTest, cls).setup_clients()
cls.client = cls.os.volume_transfers_v2_client
cls.client = cls.os_primary.volume_transfers_v2_client
cls.alt_client = cls.os_alt.volume_transfers_v2_client
cls.alt_volumes_client = cls.os_alt.volumes_v2_client
cls.adm_volumes_client = cls.os_adm.volumes_v2_client
cls.adm_volumes_client = cls.os_admin.volumes_v2_client
@decorators.idempotent_id('4d75b645-a478-48b1-97c8-503f64242f1a')
def test_create_get_list_accept_volume_transfer(self):

View File

@ -1242,9 +1242,9 @@ class EncryptionScenarioTest(ScenarioTest):
@classmethod
def setup_clients(cls):
super(EncryptionScenarioTest, cls).setup_clients()
cls.admin_volume_types_client = cls.os_adm.volume_types_v2_client
cls.admin_volume_types_client = cls.os_admin.volume_types_v2_client
cls.admin_encryption_types_client =\
cls.os_adm.encryption_types_v2_client
cls.os_admin.encryption_types_v2_client
def create_encryption_type(self, client=None, type_id=None, provider=None,
key_size=None, cipher=None,

View File

@ -38,7 +38,7 @@ class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest):
@classmethod
def setup_clients(cls):
super(TestNetworkAdvancedServerOps, cls).setup_clients()
cls.admin_servers_client = cls.os_adm.servers_client
cls.admin_servers_client = cls.os_admin.servers_client
@classmethod
def skip_checks(cls):

View File

@ -49,7 +49,7 @@ class TestServerMultinode(manager.ScenarioTest):
@test.services('compute', 'network')
def test_schedule_to_all_nodes(self):
available_zone = \
self.os_adm.availability_zone_client.list_availability_zones(
self.os_admin.availability_zone_client.list_availability_zones(
detail=True)['availabilityZoneInfo']
hosts = []
for zone in available_zone:

View File

@ -40,7 +40,7 @@ class TestVolumeMigrateRetypeAttached(manager.ScenarioTest):
@classmethod
def setup_clients(cls):
super(TestVolumeMigrateRetypeAttached, cls).setup_clients()
cls.admin_volume_types_client = cls.os_adm.volume_types_v2_client
cls.admin_volume_types_client = cls.os_admin.volume_types_v2_client
@classmethod
def skip_checks(cls):

View File

@ -331,16 +331,32 @@ class BaseTestCase(testtools.testcase.WithAttributes,
manager = cls.get_client_manager(
credential_type=credentials_type)
setattr(cls, 'os_%s' % credentials_type, manager)
# NOTE(jordanP): Tempest should use os_primary, os_admin
# and os_alt throughout its code base but we keep the aliases
# around for a while for Tempest plugins. Aliases should be
# removed eventually.
# Setup some common aliases
# TODO(andreaf) The aliases below are a temporary hack
# to avoid changing too much code in one patch. They should
# be removed eventually
if credentials_type == 'primary':
cls.os = cls.manager = cls.os_primary
cls.os = debtcollector.moves.moved_read_only_property(
'os', 'os_primary', version='Pike',
removal_version='Ocata')
cls.manager =\
debtcollector.moves.moved_read_only_property(
'manager', 'os_primary', version='Pike',
removal_version='Ocata')
if credentials_type == 'admin':
cls.os_adm = cls.admin_manager = cls.os_admin
cls.os_adm = debtcollector.moves.moved_read_only_property(
'os_adm', 'os_admin', version='Pike',
removal_version='Ocata')
cls.admin_manager =\
debtcollector.moves.moved_read_only_property(
'admin_manager', 'os_admin', version='Pike',
removal_version='Ocata')
if credentials_type == 'alt':
cls.alt_manager = cls.os_alt
cls.alt_manager =\
debtcollector.moves.moved_read_only_property(
'alt_manager', 'os_alt', version='Pike',
removal_version='Ocata')
elif isinstance(credentials_type, list):
manager = cls.get_client_manager(roles=credentials_type[1:],
force_new=True)