diff options
Diffstat (limited to 'openstackclient/tests')
| -rw-r--r-- | openstackclient/tests/functional/common/test_quota.py | 11 | ||||
| -rw-r--r-- | openstackclient/tests/unit/common/test_quota.py | 9 |
2 files changed, 20 insertions, 0 deletions
diff --git a/openstackclient/tests/functional/common/test_quota.py b/openstackclient/tests/functional/common/test_quota.py index fd45be38..9687cdb0 100644 --- a/openstackclient/tests/functional/common/test_quota.py +++ b/openstackclient/tests/functional/common/test_quota.py @@ -17,6 +17,7 @@ class QuotaTests(base.TestCase): """Functional tests for quota. """ # Test quota information for compute, network and volume. EXPECTED_FIELDS = ['instances', 'networks', 'volumes'] + EXPECTED_CLASS_FIELDS = ['instances', 'volumes'] PROJECT_NAME = None @classmethod @@ -40,3 +41,13 @@ class QuotaTests(base.TestCase): raw_output = self.openstack('quota show') for expected_field in self.EXPECTED_FIELDS: self.assertIn(expected_field, raw_output) + + def test_quota_show_with_default_option(self): + raw_output = self.openstack('quota show --default') + for expected_field in self.EXPECTED_FIELDS: + self.assertIn(expected_field, raw_output) + + def test_quota_show_with_class_option(self): + raw_output = self.openstack('quota show --class') + for expected_field in self.EXPECTED_CLASS_FIELDS: + self.assertIn(expected_field, raw_output) diff --git a/openstackclient/tests/unit/common/test_quota.py b/openstackclient/tests/unit/common/test_quota.py index cbe4cb80..ac03cb60 100644 --- a/openstackclient/tests/unit/common/test_quota.py +++ b/openstackclient/tests/unit/common/test_quota.py @@ -383,6 +383,8 @@ class TestQuotaShow(TestQuota): ) self.network = self.app.client_manager.network self.network.get_quota = mock.Mock(return_value=network_fakes.QUOTA) + self.network.get_quota_default = mock.Mock( + return_value=network_fakes.QUOTA) self.cmd = quota.ShowQuota(self.app, None) @@ -403,6 +405,7 @@ class TestQuotaShow(TestQuota): identity_fakes.project_id) self.network.get_quota.assert_called_once_with( identity_fakes.project_id) + self.assertNotCalled(self.network.get_quota_default) def test_quota_show_with_default(self): arglist = [ @@ -422,6 +425,9 @@ class TestQuotaShow(TestQuota): identity_fakes.project_id) self.volume_quotas_mock.defaults.assert_called_once_with( identity_fakes.project_id) + self.network.get_quota_default.assert_called_once_with( + identity_fakes.project_id) + self.assertNotCalled(self.network.get_quota) def test_quota_show_with_class(self): arglist = [ @@ -441,6 +447,8 @@ class TestQuotaShow(TestQuota): identity_fakes.project_id) self.volume_quotas_class_mock.get.assert_called_once_with( identity_fakes.project_id) + self.assertNotCalled(self.network.get_quota) + self.assertNotCalled(self.network.get_quota_default) def test_quota_show_no_project(self): parsed_args = self.check_parser(self.cmd, [], []) @@ -452,3 +460,4 @@ class TestQuotaShow(TestQuota): identity_fakes.project_id) self.network.get_quota.assert_called_once_with( identity_fakes.project_id) + self.assertNotCalled(self.network.get_quota_default) |
