Stop using v2 identity API

v2 identity API was deprecated in Mitaka. There is only a one test
remaining that still relies on the v2 identity API. This patch replaces
v2 with v3.

Change-Id: Iaeb9153084c6864b0982902bbb2ae9c0233266a6
This commit is contained in:
Jakub Libosvar 2017-08-15 13:45:30 +00:00 committed by Jakub Libosvar
parent bc782c8248
commit 5b51cd8dcb
3 changed files with 12 additions and 16 deletions

View File

@ -43,25 +43,22 @@ class FloatingIPAdminTestJSON(base.BaseAdminNetworkTest):
@decorators.attr(type='negative')
@decorators.idempotent_id('11116ee9-4e99-5b15-b8e1-aa7df92ca589')
def test_associate_floating_ip_with_port_from_another_tenant(self):
if not CONF.identity_feature_enabled.api_v2_admin:
# TODO(ihrachys) adopt to v3
raise self.skipException('Identity v2 admin not available')
body = self.admin_client.create_floatingip(
def test_associate_floating_ip_with_port_from_another_project(self):
body = self.client.create_floatingip(
floating_network_id=self.ext_net_id)
floating_ip = body['floatingip']
test_tenant = data_utils.rand_name('test_tenant_')
test_project = data_utils.rand_name('test_project_')
test_description = data_utils.rand_name('desc_')
tenant = self.identity_admin_client.create_tenant(
name=test_tenant, description=test_description)['tenant']
tenant_id = tenant['id']
self.addCleanup(self.identity_admin_client.delete_tenant, tenant_id)
project = self.identity_admin_client.create_project(
name=test_project, description=test_description)['project']
project_id = project['id']
self.addCleanup(self.identity_admin_client.delete_project, project_id)
port = self.admin_client.create_port(network_id=self.network['id'],
tenant_id=tenant_id)
project_id=project_id)
self.addCleanup(self.admin_client.delete_port, port['port']['id'])
self.assertRaises(lib_exc.BadRequest,
self.admin_client.update_floatingip,
self.client.update_floatingip,
floating_ip['id'], port_id=port['port']['id'])
@testtools.skipUnless(

View File

@ -37,11 +37,11 @@ class QuotasTestBase(base.BaseAdminNetworkTest):
# Add a tenant to conduct the test
test_tenant = data_utils.rand_name('test_tenant_')
test_description = data_utils.rand_name('desc_')
project = self.identity_admin_clientv3.create_project(
project = self.identity_admin_client.create_project(
name=test_tenant,
description=test_description)['project']
self.addCleanup(
self.identity_admin_clientv3.delete_project, project['id'])
self.identity_admin_client.delete_project, project['id'])
return project
def _setup_quotas(self, project_id, **new_quotas):

View File

@ -430,8 +430,7 @@ class BaseAdminNetworkTest(BaseNetworkTest):
def setup_clients(cls):
super(BaseAdminNetworkTest, cls).setup_clients()
cls.admin_client = cls.os_admin.network_client
cls.identity_admin_client = cls.os_admin.tenants_client
cls.identity_admin_clientv3 = cls.os_admin.projects_client
cls.identity_admin_client = cls.os_admin.projects_client
@classmethod
def create_metering_label(cls, name, description):