From 8d185a6a6f72ecdffc0fb90bd7e6625ad6c071a0 Mon Sep 17 00:00:00 2001 From: TerryHowe Date: Wed, 3 Jun 2015 12:03:17 -0600 Subject: [PATCH] Add functional tests for volume set and unset Add functional tests for volume set and unset for metadata and resource values. Change-Id: Ief07fc5c480608bb900d55df935b89c503609c80 --- functional/tests/volume/v1/test_volume.py | 28 ++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/functional/tests/volume/v1/test_volume.py b/functional/tests/volume/v1/test_volume.py index 9caf15630b..4a70b77963 100644 --- a/functional/tests/volume/v1/test_volume.py +++ b/functional/tests/volume/v1/test_volume.py @@ -19,6 +19,7 @@ class VolumeTests(test.TestCase): """Functional tests for volume. """ NAME = uuid.uuid4().hex + OTHER_NAME = uuid.uuid4().hex HEADERS = ['"Display Name"'] FIELDS = ['display_name'] @@ -31,7 +32,12 @@ class VolumeTests(test.TestCase): @classmethod def tearDownClass(cls): - raw_output = cls.openstack('volume delete ' + cls.NAME) + # Rename test + raw_output = cls.openstack( + 'volume set --name ' + cls.OTHER_NAME + ' ' + cls.NAME) + cls.assertOutput('', raw_output) + # Delete test + raw_output = cls.openstack('volume delete ' + cls.OTHER_NAME) cls.assertOutput('', raw_output) def test_volume_list(self): @@ -43,3 +49,23 @@ class VolumeTests(test.TestCase): opts = self.get_show_opts(self.FIELDS) raw_output = self.openstack('volume show ' + self.NAME + opts) self.assertEqual(self.NAME + "\n", raw_output) + + def test_volume_properties(self): + raw_output = self.openstack( + 'volume set --property a=b --property c=d ' + self.NAME) + self.assertEqual("", raw_output) + opts = self.get_show_opts(["properties"]) + raw_output = self.openstack('volume show ' + self.NAME + opts) + self.assertEqual("a='b', c='d'\n", raw_output) + + raw_output = self.openstack('volume unset --property a ' + self.NAME) + self.assertEqual("", raw_output) + raw_output = self.openstack('volume show ' + self.NAME + opts) + self.assertEqual("c='d'\n", raw_output) + + def test_volume_set(self): + raw_output = self.openstack( + 'volume set --description RAMAC ' + self.NAME) + opts = self.get_show_opts(["display_description", "display_name"]) + raw_output = self.openstack('volume show ' + self.NAME + opts) + self.assertEqual("RAMAC\n" + self.NAME + "\n", raw_output)