diff --git a/openstack/network/v2/quota.py b/openstack/network/v2/quota.py index a77f5aac4..c37e712ad 100644 --- a/openstack/network/v2/quota.py +++ b/openstack/network/v2/quota.py @@ -44,7 +44,7 @@ class Quota(resource.Resource): #: The maximum amount of ports you can create. *Type: int* ports = resource.Body('port', type=int) #: The ID of the project these quota values are for. - project_id = resource.Body('tenant_id') + project_id = resource.Body('tenant_id', alternate_id=True) #: The maximum amount of RBAC policies you can create. *Type: int* rbac_policies = resource.Body('rbac_policy', type=int) #: The maximum amount of routers you can create. *Type: int* diff --git a/openstack/tests/functional/network/v2/test_quota.py b/openstack/tests/functional/network/v2/test_quota.py index 14be76dde..9fa100453 100644 --- a/openstack/tests/functional/network/v2/test_quota.py +++ b/openstack/tests/functional/network/v2/test_quota.py @@ -10,8 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -import unittest - from openstack.tests.functional import base @@ -22,7 +20,6 @@ class TestQuota(base.BaseFunctionalTest): self.assertIsNotNone(qot.project_id) self.assertIsNotNone(qot.networks) - @unittest.skip('bug/1687202') def test_set(self): attrs = {'networks': 123456789} for project_quota in self.conn.network.quotas(): diff --git a/openstack/tests/unit/network/v2/test_quota.py b/openstack/tests/unit/network/v2/test_quota.py index 26b18ca42..20f55effa 100644 --- a/openstack/tests/unit/network/v2/test_quota.py +++ b/openstack/tests/unit/network/v2/test_quota.py @@ -13,6 +13,7 @@ import testtools from openstack.network.v2 import quota +from openstack import resource2 as resource IDENTIFIER = 'IDENTIFIER' EXAMPLE = { @@ -73,6 +74,13 @@ class TestQuota(testtools.TestCase): response = quota_obj._prepare_request() self.assertNotIn('id', response) + def test_alternate_id(self): + my_tenant_id = 'my-tenant-id' + body = {'tenant_id': my_tenant_id, 'network': 12345} + quota_obj = quota.Quota(**body) + self.assertEqual(my_tenant_id, + resource.Resource._get_id(quota_obj)) + class TestQuotaDefault(testtools.TestCase):