diff options
| author | Zuul <zuul@review.opendev.org> | 2022-10-07 17:05:55 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2022-10-07 17:05:55 +0000 |
| commit | 8be0c641e1ca681f4c2da8a3d2081a2a21cd2f4c (patch) | |
| tree | 383370b3a6b792648878745cea6b33980f5aefd3 /openstackclient/tests/unit/common | |
| parent | eac38feef03d6991d41552a200cd1624550525ea (diff) | |
| parent | 44443f78561ce4f23d202a42de4a4ceac2ffa097 (diff) | |
| download | python-openstackclient-8be0c641e1ca681f4c2da8a3d2081a2a21cd2f4c.tar.gz | |
Merge "quota: Add support for detailed volume quotas"
Diffstat (limited to 'openstackclient/tests/unit/common')
| -rw-r--r-- | openstackclient/tests/unit/common/test_quota.py | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/openstackclient/tests/unit/common/test_quota.py b/openstackclient/tests/unit/common/test_quota.py index 087443c1..58007208 100644 --- a/openstackclient/tests/unit/common/test_quota.py +++ b/openstackclient/tests/unit/common/test_quota.py @@ -279,6 +279,37 @@ class TestQuotaList(TestQuota): self.assertEqual( sorted(detailed_reference_data), sorted(ret_quotas)) + def test_quota_list_details_volume(self): + detailed_quota = ( + volume_fakes.FakeQuota.create_one_detailed_quota()) + + detailed_column_header = ( + 'Resource', + 'In Use', + 'Reserved', + 'Limit', + ) + detailed_reference_data = ( + self._get_detailed_reference_data(detailed_quota)) + + self.volume.quotas.get = mock.Mock(return_value=detailed_quota) + + arglist = [ + '--detail', + '--volume', + ] + verifylist = [ + ('detail', True), + ('volume', True), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + columns, data = self.cmd.take_action(parsed_args) + ret_quotas = list(data) + + self.assertEqual(detailed_column_header, columns) + self.assertEqual(sorted(detailed_reference_data), sorted(ret_quotas)) + def test_quota_list_compute(self): # Two projects with non-default quotas self.compute.quotas.get = mock.Mock( @@ -1001,7 +1032,7 @@ class TestQuotaSet(TestQuota): class TestQuotaShow(TestQuota): def setUp(self): - super(TestQuotaShow, self).setUp() + super().setUp() self.compute_quota = compute_fakes.FakeQuota.create_one_comp_quota() self.compute_quotas_mock.get.return_value = self.compute_quota @@ -1066,7 +1097,7 @@ class TestQuotaShow(TestQuota): self.projects[0].id, detail=False ) self.volume_quotas_mock.get.assert_called_once_with( - self.projects[0].id, + self.projects[0].id, usage=False ) self.network.get_quota.assert_called_once_with( self.projects[0].id, details=False @@ -1128,7 +1159,7 @@ class TestQuotaShow(TestQuota): identity_fakes.project_id, detail=False ) self.volume_quotas_mock.get.assert_called_once_with( - identity_fakes.project_id, + identity_fakes.project_id, usage=False ) self.network.get_quota.assert_called_once_with( identity_fakes.project_id, details=False |
