From 40ec7a9c96f4ce4071e47e5bf0c249aa77b5b2ee Mon Sep 17 00:00:00 2001 From: "zhiyong.dai" Date: Thu, 1 Dec 2016 02:20:23 +0800 Subject: Support --no-property in "volume set" command Add "--no-property" option to "volume set" command in v1 and v2 and update the test cases. Change-Id: Id5660f23b3b2d9aa72f4c16b19ce83f3f7ed2fa4 --- .../tests/functional/volume/v1/test_volume.py | 9 +++++---- .../tests/functional/volume/v2/test_volume.py | 22 +++++++++++++++++----- 2 files changed, 22 insertions(+), 9 deletions(-) (limited to 'openstackclient/tests/functional/volume') diff --git a/openstackclient/tests/functional/volume/v1/test_volume.py b/openstackclient/tests/functional/volume/v1/test_volume.py index 992dfd66..3f04e071 100644 --- a/openstackclient/tests/functional/volume/v1/test_volume.py +++ b/openstackclient/tests/functional/volume/v1/test_volume.py @@ -141,8 +141,9 @@ class VolumeTests(common.BaseVolumeTests): '--name ' + new_name + ' --size 2 ' + '--description bbbb ' + - '--property Alpha=c ' + + '--no-property ' + '--property Beta=b ' + + '--property Gamma=c ' + '--bootable ' + name, ) @@ -165,7 +166,7 @@ class VolumeTests(common.BaseVolumeTests): cmd_output["display_description"], ) self.assertEqual( - "Alpha='c', Beta='b'", + "Beta='b', Gamma='c'", cmd_output["properties"], ) self.assertEqual( @@ -176,7 +177,7 @@ class VolumeTests(common.BaseVolumeTests): # Test volume unset raw_output = self.openstack( 'volume unset ' + - '--property Alpha ' + + '--property Beta ' + new_name, ) self.assertOutput('', raw_output) @@ -186,7 +187,7 @@ class VolumeTests(common.BaseVolumeTests): new_name )) self.assertEqual( - "Beta='b'", + "Gamma='c'", cmd_output["properties"], ) diff --git a/openstackclient/tests/functional/volume/v2/test_volume.py b/openstackclient/tests/functional/volume/v2/test_volume.py index 203ca819..ce98236f 100644 --- a/openstackclient/tests/functional/volume/v2/test_volume.py +++ b/openstackclient/tests/functional/volume/v2/test_volume.py @@ -104,7 +104,7 @@ class VolumeTests(common.BaseVolumeTests): # TODO(qiangjiahui): Add project option to filter tests when we can # specify volume with project - def test_volume_set(self): + def test_volume_set_and_unset(self): """Tests create volume, set, unset, show, delete""" name = uuid.uuid4().hex new_name = name + "_" @@ -144,8 +144,11 @@ class VolumeTests(common.BaseVolumeTests): '--name ' + new_name + ' --size 2 ' + '--description bbbb ' + - '--property Alpha=c ' + + '--no-property ' + '--property Beta=b ' + + '--property Gamma=c ' + + '--image-property a=b ' + + '--image-property c=d ' + '--bootable ' + name, ) @@ -168,9 +171,13 @@ class VolumeTests(common.BaseVolumeTests): cmd_output["description"], ) self.assertEqual( - "Alpha='c', Beta='b'", + "Beta='b', Gamma='c'", cmd_output["properties"], ) + self.assertEqual( + {'a': 'b', 'c': 'd'}, + cmd_output["volume_image_metadata"], + ) self.assertEqual( 'true', cmd_output["bootable"], @@ -179,7 +186,8 @@ class VolumeTests(common.BaseVolumeTests): # Test volume unset raw_output = self.openstack( 'volume unset ' + - '--property Alpha ' + + '--property Beta ' + + '--image-property a ' + new_name, ) self.assertOutput('', raw_output) @@ -189,9 +197,13 @@ class VolumeTests(common.BaseVolumeTests): new_name )) self.assertEqual( - "Beta='b'", + "Gamma='c'", cmd_output["properties"], ) + self.assertEqual( + {'c': 'd'}, + cmd_output["volume_image_metadata"], + ) def test_volume_snapshot(self): """Tests volume create from snapshot""" -- cgit v1.2.1