diff options
| author | Tang Chen <chen.tang@easystack.cn> | 2016-02-17 15:16:33 +0800 |
|---|---|---|
| committer | Tang Chen <chen.tang@easystack.cn> | 2016-02-27 03:50:47 +0800 |
| commit | ba826fa04fd5f16658da0319f34e26f14d7716d2 (patch) | |
| tree | f3e88223f0e9e614ffc334ec140e49dff30f847b /functional | |
| parent | 9c91c1df4147cbd277c3384b0c648a6069c5f723 (diff) | |
| download | python-openstackclient-ba826fa04fd5f16658da0319f34e26f14d7716d2.tar.gz | |
Make SetAggregate inherit from cliff.Command
set/unset comamnd classes should inherit from cliff.Command class.
Also, this patch adds functional tests for aggregate.
And also, use utils.format_dict() to format the output of the
properties dict.
Change-Id: Idb50bef8990da95666960e2414dfd7c9be234bba
Partial-bug: #1519503
Closes-Bug: 1546065
Diffstat (limited to 'functional')
| -rw-r--r-- | functional/tests/compute/v2/test_aggregate.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/functional/tests/compute/v2/test_aggregate.py b/functional/tests/compute/v2/test_aggregate.py new file mode 100644 index 00000000..73e51ede --- /dev/null +++ b/functional/tests/compute/v2/test_aggregate.py @@ -0,0 +1,56 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import uuid + +from functional.common import test + + +class AggregateTests(test.TestCase): + """Functional tests for aggregate. """ + + NAME = uuid.uuid4().hex + HEADERS = ['Name'] + FIELDS = ['name'] + + @classmethod + def setUpClass(cls): + opts = cls.get_show_opts(cls.FIELDS) + raw_output = cls.openstack('aggregate create ' + cls.NAME + opts) + expected = cls.NAME + '\n' + cls.assertOutput(expected, raw_output) + + @classmethod + def tearDownClass(cls): + raw_output = cls.openstack('aggregate delete ' + cls.NAME) + cls.assertOutput('', raw_output) + + def test_aggregate_list(self): + opts = self.get_list_opts(self.HEADERS) + raw_output = self.openstack('aggregate list' + opts) + self.assertIn(self.NAME, raw_output) + + def test_aggregate_show(self): + opts = self.get_show_opts(self.FIELDS) + raw_output = self.openstack('aggregate show ' + self.NAME + opts) + self.assertEqual(self.NAME + "\n", raw_output) + + def test_aggregate_properties(self): + opts = self.get_show_opts(['properties']) + + raw_output = self.openstack( + 'aggregate set --property a=b --property c=d ' + self.NAME + ) + self.assertEqual('', raw_output) + + raw_output = self.openstack('aggregate show ' + self.NAME + opts) + self.assertIn("a='b', c='d'\n", raw_output) |
