diff options
| author | asarfaty <asarfaty@vmware.com> | 2020-08-16 09:23:56 +0200 |
|---|---|---|
| committer | Adit Sarfaty <asarfaty@vmware.com> | 2020-09-22 05:12:09 +0000 |
| commit | e9bd4ef007153e4f2e2d69f3bcb94eef8e8983c2 (patch) | |
| tree | ecf172ce5a2c04479038373ac3bbd90b96f51264 /openstackclient/tests | |
| parent | 51aee432d96c0291d01419c3db2248114d176fdd (diff) | |
| download | python-openstackclient-e9bd4ef007153e4f2e2d69f3bcb94eef8e8983c2.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
Diffstat (limited to 'openstackclient/tests')
| -rw-r--r-- | openstackclient/tests/unit/common/test_quota.py | 23 |
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 |
