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:54:04 +0000
commitdd06a4c475a1813dc72bf439bfdcb47deec89049 (patch)
tree618b29fd7de4253e24cccb15521b3c0e75f0bde5 /openstackclient/tests
parent83cd9b5b9c3b4c471b41190675f880599b78e44e (diff)
downloadpython-openstackclient-dd06a4c475a1813dc72bf439bfdcb47deec89049.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 6504c5b0..8771359c 100644
--- a/openstackclient/tests/unit/common/test_quota.py
+++ b/openstackclient/tests/unit/common/test_quota.py
@@ -1087,3 +1087,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