summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-09-14 18:48:28 +0000
committerGerrit Code Review <review@openstack.org>2016-09-14 18:48:28 +0000
commit276675f3520fa707daa65f92219194a514623fb8 (patch)
tree5465e42f15e49317a85b07e7a704dd70922b58c8 /openstackclient/tests
parent807ff825ef29355c802fa5d5a9458931a1011f8a (diff)
parent6a914d0056e810e1ef37eaf4f01cd5c85217aba6 (diff)
downloadpython-openstackclient-276675f3520fa707daa65f92219194a514623fb8.tar.gz
Merge "Support mark volume as bootable in volume set"
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/functional/volume/v1/test_volume.py11
-rw-r--r--openstackclient/tests/functional/volume/v2/test_volume.py11
-rw-r--r--openstackclient/tests/unit/volume/v1/test_volume.py27
-rw-r--r--openstackclient/tests/unit/volume/v2/test_volume.py27
4 files changed, 76 insertions, 0 deletions
diff --git a/openstackclient/tests/functional/volume/v1/test_volume.py b/openstackclient/tests/functional/volume/v1/test_volume.py
index 6ac7f2bf..5e4bcbea 100644
--- a/openstackclient/tests/functional/volume/v1/test_volume.py
+++ b/openstackclient/tests/functional/volume/v1/test_volume.py
@@ -75,3 +75,14 @@ class VolumeTests(common.BaseVolumeTests):
opts = self.get_opts(["display_name", "size"])
raw_output = self.openstack('volume show ' + self.NAME + opts)
self.assertEqual(self.NAME + "\n2\n", raw_output)
+
+ def test_volume_set_bootable(self):
+ self.openstack('volume set --bootable ' + self.NAME)
+ opts = self.get_opts(["bootable"])
+ raw_output = self.openstack('volume show ' + self.NAME + opts)
+ self.assertEqual("true\n", raw_output)
+
+ self.openstack('volume set --non-bootable ' + self.NAME)
+ opts = self.get_opts(["bootable"])
+ raw_output = self.openstack('volume show ' + self.NAME + opts)
+ self.assertEqual("false\n", raw_output)
diff --git a/openstackclient/tests/functional/volume/v2/test_volume.py b/openstackclient/tests/functional/volume/v2/test_volume.py
index 73273573..fb880578 100644
--- a/openstackclient/tests/functional/volume/v2/test_volume.py
+++ b/openstackclient/tests/functional/volume/v2/test_volume.py
@@ -91,6 +91,17 @@ class VolumeTests(common.BaseVolumeTests):
raw_output = self.openstack('volume show ' + self.NAME + opts)
self.assertEqual(self.NAME + "\n2\n", raw_output)
+ def test_volume_set_bootable(self):
+ self.openstack('volume set --bootable ' + self.NAME)
+ opts = self.get_opts(["bootable"])
+ raw_output = self.openstack('volume show ' + self.NAME + opts)
+ self.assertEqual("true\n", raw_output)
+
+ self.openstack('volume set --non-bootable ' + self.NAME)
+ opts = self.get_opts(["bootable"])
+ raw_output = self.openstack('volume show ' + self.NAME + opts)
+ self.assertEqual("false\n", raw_output)
+
def test_volume_snapshot(self):
opts = self.get_opts(self.FIELDS)
diff --git a/openstackclient/tests/unit/volume/v1/test_volume.py b/openstackclient/tests/unit/volume/v1/test_volume.py
index 54ec9e7e..e95f42d0 100644
--- a/openstackclient/tests/unit/volume/v1/test_volume.py
+++ b/openstackclient/tests/unit/volume/v1/test_volume.py
@@ -844,6 +844,8 @@ class TestVolumeSet(TestVolume):
('size', None),
('property', {'myprop': 'myvalue'}),
('volume', volume_fakes.volume_name),
+ ('bootable', False),
+ ('non_bootable', False)
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -858,3 +860,28 @@ class TestVolumeSet(TestVolume):
metadata
)
self.assertIsNone(result)
+
+ def test_volume_set_bootable(self):
+ arglist = [
+ ['--bootable', volume_fakes.volume_id],
+ ['--non-bootable', volume_fakes.volume_id]
+ ]
+ verifylist = [
+ [
+ ('bootable', True),
+ ('non_bootable', False),
+ ('volume', volume_fakes.volume_id)
+ ],
+ [
+ ('bootable', False),
+ ('non_bootable', True),
+ ('volume', volume_fakes.volume_id)
+ ]
+ ]
+ for index in range(len(arglist)):
+ parsed_args = self.check_parser(
+ self.cmd, arglist[index], verifylist[index])
+
+ self.cmd.take_action(parsed_args)
+ self.volumes_mock.set_bootable.assert_called_with(
+ volume_fakes.volume_id, verifylist[index][0][1])
diff --git a/openstackclient/tests/unit/volume/v2/test_volume.py b/openstackclient/tests/unit/volume/v2/test_volume.py
index 951812f4..5bdde9de 100644
--- a/openstackclient/tests/unit/volume/v2/test_volume.py
+++ b/openstackclient/tests/unit/volume/v2/test_volume.py
@@ -905,6 +905,8 @@ class TestVolumeSet(TestVolume):
verifylist = [
('image_property', {'Alpha': 'a', 'Beta': 'b'}),
('volume', self.new_volume.id),
+ ('bootable', False),
+ ('non_bootable', False)
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -952,6 +954,31 @@ class TestVolumeSet(TestVolume):
self.volumes_mock.reset_state.assert_called_with(
self.new_volume.id, 'error')
+ def test_volume_set_bootable(self):
+ arglist = [
+ ['--bootable', self.new_volume.id],
+ ['--non-bootable', self.new_volume.id]
+ ]
+ verifylist = [
+ [
+ ('bootable', True),
+ ('non_bootable', False),
+ ('volume', self.new_volume.id)
+ ],
+ [
+ ('bootable', False),
+ ('non_bootable', True),
+ ('volume', self.new_volume.id)
+ ]
+ ]
+ for index in range(len(arglist)):
+ parsed_args = self.check_parser(
+ self.cmd, arglist[index], verifylist[index])
+
+ self.cmd.take_action(parsed_args)
+ self.volumes_mock.set_bootable.assert_called_with(
+ self.new_volume.id, verifylist[index][0][1])
+
class TestVolumeShow(TestVolume):