compute: Correct base path for default, detailed quotas

For some reason, you need to include the project ID in the path even
though it's wholly ignored.

Change-Id: I805cdfaa89134e92eeb9726697925e9d0657af19
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane
2024-07-10 11:39:18 +01:00
parent 1812926973
commit d40d6a2e82
3 changed files with 7 additions and 6 deletions

View File

@@ -2465,7 +2465,8 @@ class Proxy(proxy.Proxy):
None, None,
project_id=project.id, project_id=project.id,
) )
return res.fetch(self, usage=usage, **query) base_path = '/os-quota-sets/%(project_id)s/detail' if usage else None
return res.fetch(self, base_path=base_path, **query)
def get_quota_set_defaults(self, project): def get_quota_set_defaults(self, project):
"""Show QuotaSet defaults for the project """Show QuotaSet defaults for the project
@@ -2484,7 +2485,9 @@ class Proxy(proxy.Proxy):
None, None,
project_id=project.id, project_id=project.id,
) )
return res.fetch(self, base_path='/os-quota-sets/defaults') return res.fetch(
self, base_path='/os-quota-sets/%(project_id)s/defaults'
)
def revert_quota_set(self, project, **query): def revert_quota_set(self, project, **query):
"""Reset Quota for the project/user. """Reset Quota for the project/user.

View File

@@ -125,7 +125,6 @@ class TestQuotas(base.TestCase):
'compute', 'compute',
'public', 'public',
append=['os-quota-sets', project.project_id], append=['os-quota-sets', project.project_id],
qs_elements=['usage=False'],
), ),
json={'quota_set': fake_quota_set}, json={'quota_set': fake_quota_set},
), ),

View File

@@ -1642,7 +1642,6 @@ class TestQuotaSet(TestComputeProxy):
expected_kwargs={ expected_kwargs={
'error_message': None, 'error_message': None,
'requires_id': False, 'requires_id': False,
'usage': False,
}, },
method_result=quota_set.QuotaSet(), method_result=quota_set.QuotaSet(),
expected_result=quota_set.QuotaSet(), expected_result=quota_set.QuotaSet(),
@@ -1658,8 +1657,8 @@ class TestQuotaSet(TestComputeProxy):
expected_kwargs={ expected_kwargs={
'error_message': None, 'error_message': None,
'requires_id': False, 'requires_id': False,
'usage': True,
'user_id': 'uid', 'user_id': 'uid',
'base_path': '/os-quota-sets/%(project_id)s/detail',
}, },
) )
@@ -1672,7 +1671,7 @@ class TestQuotaSet(TestComputeProxy):
expected_kwargs={ expected_kwargs={
'error_message': None, 'error_message': None,
'requires_id': False, 'requires_id': False,
'base_path': '/os-quota-sets/defaults', 'base_path': '/os-quota-sets/%(project_id)s/defaults',
}, },
) )