diff options
| author | Sławek Kapłoński <slawek@kaplonski.pl> | 2018-10-19 12:46:21 +0300 |
|---|---|---|
| committer | Vlad Gusev <vlad.esten@gmail.com> | 2019-02-24 10:41:53 +0000 |
| commit | 75cba9d1cbdd7b14b0d507af27f896c6c45e713e (patch) | |
| tree | 0e09aa73240b1618083593eb57f7aa2628a000d0 /openstackclient/tests/functional | |
| parent | 0a187905c01f6bc2b9855081ac0042f00715dedf (diff) | |
| download | python-openstackclient-75cba9d1cbdd7b14b0d507af27f896c6c45e713e.tar.gz | |
Add support for get details of Quota
With passing "--detail" argument to "openstack quota list", details
about current usage should be returned.
It is currently supported by Nova and Neutron so details of
resources from those projects can be returned.
Change-Id: I48fda15b34283bb7c66ea18ed28262f48b9229fe
Related-Bug: #1716043
Diffstat (limited to 'openstackclient/tests/functional')
| -rw-r--r-- | openstackclient/tests/functional/common/test_quota.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/openstackclient/tests/functional/common/test_quota.py b/openstackclient/tests/functional/common/test_quota.py index 76c69a4d..85942281 100644 --- a/openstackclient/tests/functional/common/test_quota.py +++ b/openstackclient/tests/functional/common/test_quota.py @@ -31,6 +31,38 @@ class QuotaTests(base.TestCase): cls.PROJECT_NAME =\ cls.get_openstack_configuration_value('auth.project_name') + def test_quota_list_details_compute(self): + expected_headers = ["Resource", "In Use", "Reserved", "Limit"] + cmd_output = json.loads(self.openstack( + 'quota list -f json --detail --compute' + )) + self.assertIsNotNone(cmd_output) + resources = [] + for row in cmd_output: + row_headers = [str(r) for r in row.keys()] + self.assertEqual(sorted(expected_headers), sorted(row_headers)) + resources.append(row['Resource']) + # Ensure that returned quota is compute quota + self.assertIn("instances", resources) + # and that there is no network quota here + self.assertNotIn("networks", resources) + + def test_quota_list_details_network(self): + expected_headers = ["Resource", "In Use", "Reserved", "Limit"] + cmd_output = json.loads(self.openstack( + 'quota list -f json --detail --network' + )) + self.assertIsNotNone(cmd_output) + resources = [] + for row in cmd_output: + row_headers = [str(r) for r in row.keys()] + self.assertEqual(sorted(expected_headers), sorted(row_headers)) + resources.append(row['Resource']) + # Ensure that returned quota is network quota + self.assertIn("networks", resources) + # and that there is no compute quota here + self.assertNotIn("instances", resources) + def test_quota_list_network_option(self): if not self.haz_network: self.skipTest("No Network service present") |
