diff options
| author | zhiyong.dai <zhiyong.dai@easystack.cn> | 2016-11-22 02:19:12 +0800 |
|---|---|---|
| committer | Steve Martinelli <s.martinelli@gmail.com> | 2017-01-16 20:58:33 +0000 |
| commit | 2476a26d995a1415357eeffb78a1a832be8ed470 (patch) | |
| tree | 2df58a91e21e02175e15889cbbd171249d51b8a0 /openstackclient | |
| parent | b55b1d2b94c7ef668ab06b4047a7bf2209d9b275 (diff) | |
| download | python-openstackclient-2476a26d995a1415357eeffb78a1a832be8ed470.tar.gz | |
Update functional test for aggregate.
Add the following functional tests :
option: "--no-property"
command: "aggregate set --zone",
"aggregate add host",
"aggregate remove host".
Change-Id: Ia9c31facb5f0f5b92b8df950fd4021b8ecc924c5
Diffstat (limited to 'openstackclient')
| -rw-r--r-- | openstackclient/tests/functional/compute/v2/test_aggregate.py | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/openstackclient/tests/functional/compute/v2/test_aggregate.py b/openstackclient/tests/functional/compute/v2/test_aggregate.py index 2bc88e7b..38368103 100644 --- a/openstackclient/tests/functional/compute/v2/test_aggregate.py +++ b/openstackclient/tests/functional/compute/v2/test_aggregate.py @@ -48,7 +48,7 @@ class AggregateTests(base.TestCase): self.assertEqual(self.NAME + "\n", raw_output) def test_aggregate_properties(self): - opts = self.get_opts(['properties']) + opts = self.get_opts(['name', 'properties']) raw_output = self.openstack( 'aggregate set --property a=b --property c=d ' + self.NAME @@ -56,7 +56,7 @@ class AggregateTests(base.TestCase): self.assertEqual('', raw_output) raw_output = self.openstack('aggregate show ' + self.NAME + opts) - self.assertIn("a='b', c='d'\n", raw_output) + self.assertIn(self.NAME + "\na='b', c='d'\n", raw_output) raw_output = self.openstack( 'aggregate unset --property a ' + self.NAME @@ -64,4 +64,44 @@ class AggregateTests(base.TestCase): self.assertEqual('', raw_output) raw_output = self.openstack('aggregate show ' + self.NAME + opts) - self.assertIn("c='d'\n", raw_output) + self.assertIn(self.NAME + "\nc='d'\n", raw_output) + + raw_output = self.openstack( + 'aggregate set --property a=b --property c=d ' + self.NAME + ) + self.assertEqual('', raw_output) + + raw_output = self.openstack( + 'aggregate set --no-property ' + self.NAME + ) + self.assertEqual('', raw_output) + + raw_output = self.openstack('aggregate show ' + self.NAME + opts) + self.assertNotIn("a='b', c='d'", raw_output) + + def test_aggregate_set(self): + opts = self.get_opts(["name", "availability_zone"]) + + raw_output = self.openstack( + 'aggregate set --zone Zone_1 ' + self.NAME) + self.assertEqual("", raw_output) + + raw_output = self.openstack('aggregate show ' + self.NAME + opts) + self.assertEqual("Zone_1\n" + self.NAME + "\n", raw_output) + + def test_aggregate_add_and_remove_host(self): + opts = self.get_opts(["hosts", "name"]) + + raw_output = self.openstack('host list -f value -c "Host Name"') + host_name = raw_output.split()[0] + + self.openstack( + 'aggregate add host ' + self.NAME + ' ' + host_name) + raw_output = self.openstack('aggregate show ' + self.NAME + opts) + self.assertEqual("[u'" + host_name + "']" + "\n" + self.NAME + "\n", + raw_output) + + self.openstack( + 'aggregate remove host ' + self.NAME + ' ' + host_name) + raw_output = self.openstack('aggregate show ' + self.NAME + opts) + self.assertEqual("[]\n" + self.NAME + "\n", raw_output) |
