summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorasarfaty <asarfaty@vmware.com>2020-08-16 09:23:56 +0200
committerAdit Sarfaty <asarfaty@vmware.com>2021-02-17 04:55:31 +0000
commitb948e74b88befca67eab57573444e81f44eb75c9 (patch)
tree39f68ef465d99f7c3d847414468825275b69c589 /openstackclient/tests
parent54bf2c054d7b8287de5cb20dfbf03af0383c29c9 (diff)
downloadpython-openstackclient-b948e74b88befca67eab57573444e81f44eb75c9.tar.gz
Remove None valued network quota entries
Since the openstack SDK still has the neutron-lbaas entries in the network quota, but those are already deprecated [1], the 'opentack quota show' command shows those as None value. This fix removes those empty deprecated values from the output. [1] https://review.opendev.org/#/c/658494/ Change-Id: I8dbdba2a029ea8e6a268ddf29627e1466a7e3a8a (cherry picked from commit e9bd4ef007153e4f2e2d69f3bcb94eef8e8983c2)
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/unit/common/test_quota.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/common/test_quota.py b/openstackclient/tests/unit/common/test_quota.py
index 297452a2..f519f872 100644
--- a/openstackclient/tests/unit/common/test_quota.py
+++ b/openstackclient/tests/unit/common/test_quota.py
@@ -968,3 +968,26 @@ class TestQuotaShow(TestQuota):
identity_fakes.project_id, details=False
)
self.assertNotCalled(self.network.get_quota_default)
+
+ def test_network_quota_show_remove_empty(self):
+ arglist = [
+ self.projects[0].name,
+ ]
+ verifylist = [
+ ('project', self.projects[0].name),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ # First check that all regular values are returned
+ result = self.cmd.get_network_quota(parsed_args)
+ self.assertEqual(len(network_fakes.QUOTA), len(result))
+
+ # set 1 of the values to None, and verify it is not returned
+ orig_get_quota = self.network.get_quota
+ network_quotas = copy.copy(network_fakes.QUOTA)
+ network_quotas['healthmonitor'] = None
+ self.network.get_quota = mock.Mock(return_value=network_quotas)
+ result = self.cmd.get_network_quota(parsed_args)
+ self.assertEqual(len(network_fakes.QUOTA) - 1, len(result))
+ # Go back to default mock
+ self.network.get_quota = orig_get_quota