From 8d59b31c72468d82cbe79a6cf24df28fb3b6cf06 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Wed, 29 Jun 2016 14:43:38 +0800 Subject: [PATCH] Add functional tests for unset multiple volume type props CinderClient bug/1596511 cause that OSC can't unset multiple properties of volume type, obviously no functional test case cover the part of logic in OSC, that make the issue raising, the patch add functional test cases for this scenario. Change-Id: I42cf9ac8cc72ccc2f1208926d8faf7b80ee2d288 Partial-Bug: #1596511 Depends-On: I60378a32cdc52aacdf869d69b246dec7eb6cdb77 --- .../functional/volume/v1/test_volume_type.py | 15 +++++++++++++++ .../functional/volume/v2/test_volume_type.py | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/openstackclient/tests/functional/volume/v1/test_volume_type.py b/openstackclient/tests/functional/volume/v1/test_volume_type.py index 538545abc6..955759b6b2 100644 --- a/openstackclient/tests/functional/volume/v1/test_volume_type.py +++ b/openstackclient/tests/functional/volume/v1/test_volume_type.py @@ -61,6 +61,21 @@ class VolumeTypeTests(common.BaseVolumeTests): raw_output = self.openstack('volume type show ' + self.NAME + opts) self.assertEqual("c='d'\n", raw_output) + def test_volume_type_set_unset_multiple_properties(self): + raw_output = self.openstack( + 'volume type set --property a=b --property c=d ' + self.NAME) + self.assertEqual("", raw_output) + + opts = self.get_opts(["properties"]) + raw_output = self.openstack('volume type show ' + self.NAME + opts) + self.assertEqual("a='b', c='d'\n", raw_output) + + raw_output = self.openstack( + 'volume type unset --property a --property c ' + self.NAME) + self.assertEqual("", raw_output) + raw_output = self.openstack('volume type show ' + self.NAME + opts) + self.assertEqual("\n", raw_output) + def test_multi_delete(self): vol_type1 = uuid.uuid4().hex vol_type2 = uuid.uuid4().hex diff --git a/openstackclient/tests/functional/volume/v2/test_volume_type.py b/openstackclient/tests/functional/volume/v2/test_volume_type.py index b62cbb3908..d8bd3a96c1 100644 --- a/openstackclient/tests/functional/volume/v2/test_volume_type.py +++ b/openstackclient/tests/functional/volume/v2/test_volume_type.py @@ -62,6 +62,21 @@ class VolumeTypeTests(common.BaseVolumeTests): raw_output = self.openstack('volume type show ' + self.NAME + opts) self.assertEqual("c='d'\n", raw_output) + def test_volume_type_set_unset_multiple_properties(self): + raw_output = self.openstack( + 'volume type set --property a=b --property c=d ' + self.NAME) + self.assertEqual("", raw_output) + + opts = self.get_opts(["properties"]) + raw_output = self.openstack('volume type show ' + self.NAME + opts) + self.assertEqual("a='b', c='d'\n", raw_output) + + raw_output = self.openstack( + 'volume type unset --property a --property c ' + self.NAME) + self.assertEqual("", raw_output) + raw_output = self.openstack('volume type show ' + self.NAME + opts) + self.assertEqual("\n", raw_output) + def test_volume_type_set_unset_project(self): raw_output = self.openstack( 'volume type set --project admin ' + self.NAME)