|
| 1 | +# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 | +# not use this file except in compliance with the License. You may obtain |
| 3 | +# a copy of the License at |
| 4 | +# |
| 5 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | +# |
| 7 | +# Unless required by applicable law or agreed to in writing, software |
| 8 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 | +# License for the specific language governing permissions and limitations |
| 11 | +# under the License. |
| 12 | + |
| 13 | +from functional.common import test |
| 14 | + |
| 15 | + |
| 16 | +class QuotaTests(test.TestCase): |
| 17 | + """Functional tests for quota. """ |
| 18 | + # Test quota information for compute, network and volume. |
| 19 | + EXPECTED_FIELDS = ['instances', 'network', 'volumes'] |
| 20 | + PROJECT_NAME = None |
| 21 | + |
| 22 | + @classmethod |
| 23 | + def setUpClass(cls): |
| 24 | + cls.PROJECT_NAME =\ |
| 25 | + cls.get_openstack_configuration_value('auth.project_name') |
| 26 | + |
| 27 | + def test_quota_set(self): |
| 28 | + # TODO(rtheis): Add --network option once supported on set. |
| 29 | + self.openstack('quota set --instances 11 --volumes 11 ' + |
| 30 | + self.PROJECT_NAME) |
| 31 | + opts = self.get_show_opts(self.EXPECTED_FIELDS) |
| 32 | + raw_output = self.openstack('quota show ' + self.PROJECT_NAME + opts) |
| 33 | + self.assertEqual("11\n10\n11\n", raw_output) |
| 34 | + |
| 35 | + def test_quota_show(self): |
| 36 | + raw_output = self.openstack('quota show ' + self.PROJECT_NAME) |
| 37 | + for expected_field in self.EXPECTED_FIELDS: |
| 38 | + self.assertInOutput(expected_field, raw_output) |
0 commit comments