summaryrefslogtreecommitdiff
path: root/openstackclient/tests/common
diff options
context:
space:
mode:
authorRichard Theis <rtheis@us.ibm.com>2015-12-21 16:17:34 -0600
committerSteve Martinelli <stevemar@ca.ibm.com>2016-02-02 02:02:53 +0000
commit5d1a93362da1109a9f49c32c142a8a4df0a97a9e (patch)
treee0ea53537bf4e78314b40e92466e5419fcabb682 /openstackclient/tests/common
parente9ff42eee73de147339c42bca90f777a8f40f5c1 (diff)
downloadpython-openstackclient-5d1a93362da1109a9f49c32c142a8a4df0a97a9e.tar.gz
Fix showing network quotas for a project
The OpenStack SDK is now used for the network client. However, the 'openstack quota show' command wasn't updated for the client change. As a result, the command will fail to show network quotas when a project name is specified. For example: $ openstack quota show admin 'Proxy' object has no attribute 'show_quota' This patch set fixes the command by using the OpenStack SDK to get network quotas for a project. Change-Id: I59a7b6780a7b80cd09e79d40d214751b25d3016e Related-To: blueprint neutron-client Closes-Bug: #1528249
Diffstat (limited to 'openstackclient/tests/common')
-rw-r--r--openstackclient/tests/common/test_quota.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/openstackclient/tests/common/test_quota.py b/openstackclient/tests/common/test_quota.py
index 485b8a8b..edf29c9b 100644
--- a/openstackclient/tests/common/test_quota.py
+++ b/openstackclient/tests/common/test_quota.py
@@ -214,13 +214,15 @@ class TestQuotaShow(TestQuota):
loaded=True,
)
- self.service_catalog_mock.get_endpoints.return_value = [
- fakes.FakeResource(
- None,
- copy.deepcopy(identity_fakes.ENDPOINT),
- loaded=True,
- )
- ]
+ fake_network_endpoint = fakes.FakeResource(
+ None,
+ copy.deepcopy(identity_fakes.ENDPOINT),
+ loaded=True,
+ )
+
+ self.service_catalog_mock.get_endpoints.return_value = {
+ 'network': fake_network_endpoint
+ }
self.quotas_class_mock.get.return_value = FakeQuotaResource(
None,
@@ -244,6 +246,8 @@ class TestQuotaShow(TestQuota):
endpoint=fakes.AUTH_URL,
token=fakes.AUTH_TOKEN,
)
+ self.network = self.app.client_manager.network
+ self.network.get_quota = mock.Mock(return_value=network_fakes.QUOTA)
self.cmd = quota.ShowQuota(self.app, None)
@@ -260,6 +264,9 @@ class TestQuotaShow(TestQuota):
self.cmd.take_action(parsed_args)
self.quotas_mock.get.assert_called_with(identity_fakes.project_id)
+ self.volume_quotas_mock.get.assert_called_with(
+ identity_fakes.project_id)
+ self.network.get_quota.assert_called_with(identity_fakes.project_id)
def test_quota_show_with_default(self):
arglist = [
@@ -276,6 +283,8 @@ class TestQuotaShow(TestQuota):
self.cmd.take_action(parsed_args)
self.quotas_mock.defaults.assert_called_with(identity_fakes.project_id)
+ self.volume_quotas_mock.defaults.assert_called_with(
+ identity_fakes.project_id)
def test_quota_show_with_class(self):
arglist = [
@@ -293,3 +302,5 @@ class TestQuotaShow(TestQuota):
self.quotas_class_mock.get.assert_called_with(
identity_fakes.project_id)
+ self.volume_quotas_class_mock.get.assert_called_with(
+ identity_fakes.project_id)