summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorroot <ranasheel2000@gmail.com>2016-03-10 09:30:47 +0530
committerSteve Martinelli <stevemar@ca.ibm.com>2016-03-16 10:22:00 -0400
commit9bafea555d6ef84817976621d40522172c5b351f (patch)
tree147c9de70d3aa0bda3fb6a1ee28f4e3e97d6b735 /openstackclient/tests
parent4d5c5d9dcb6421e56823aad932bff5d87b728bb2 (diff)
downloadpython-openstackclient-9bafea555d6ef84817976621d40522172c5b351f.tar.gz
Add support for deleting Image-property
OSC does not support to delete volume's image property. This patch will provide support for deleting image property to existing volume. Closes-Bug:#1554879 Change-Id: I9256913948fae9e9a03fed173b826dfa918f78e9 Implements: bp cinder-command-support
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/volume/v2/test_volume.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/openstackclient/tests/volume/v2/test_volume.py b/openstackclient/tests/volume/v2/test_volume.py
index 29fc391e..12253806 100644
--- a/openstackclient/tests/volume/v2/test_volume.py
+++ b/openstackclient/tests/volume/v2/test_volume.py
@@ -783,3 +783,56 @@ class TestVolumeSet(TestVolume):
self.cmd.take_action(parsed_args)
self.volumes_mock.set_image_metadata.assert_called_with(
self.volumes_mock.get().id, parsed_args.image_property)
+
+
+class TestVolumeUnset(TestVolume):
+
+ def setUp(self):
+ super(TestVolumeUnset, self).setUp()
+
+ self.new_volume = volume_fakes.FakeVolume.create_one_volume()
+ self.volumes_mock.create.return_value = self.new_volume
+
+ # Get the command object to set property
+ self.cmd_set = volume.SetVolume(self.app, None)
+
+ # Get the command object to unset property
+ self.cmd_unset = volume.UnsetVolume(self.app, None)
+
+ def test_volume_unset_image_property(self):
+
+ # Arguments for setting image properties
+ arglist = [
+ '--image-property', 'Alpha=a',
+ '--image-property', 'Beta=b',
+ self.new_volume.id,
+ ]
+ verifylist = [
+ ('image_property', {'Alpha': 'a', 'Beta': 'b'}),
+ ('volume', self.new_volume.id),
+ ]
+ parsed_args = self.check_parser(self.cmd_set, arglist, verifylist)
+
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns nothing
+ self.cmd_set.take_action(parsed_args)
+
+ # Arguments for unsetting image properties
+ arglist_unset = [
+ '--image-property', 'Alpha',
+ self.new_volume.id,
+ ]
+ verifylist_unset = [
+ ('image_property', ['Alpha']),
+ ('volume', self.new_volume.id),
+ ]
+ parsed_args_unset = self.check_parser(self.cmd_unset,
+ arglist_unset,
+ verifylist_unset)
+
+ # In base command class ShowOne in cliff, abstract method take_action()
+ # returns nothing
+ self.cmd_unset.take_action(parsed_args_unset)
+
+ self.volumes_mock.delete_image_metadata.assert_called_with(
+ self.volumes_mock.get().id, parsed_args_unset.image_property)