diff options
| author | Huanxuan Ao <huanxuan.ao@easystack.cn> | 2016-09-14 14:54:29 +0800 |
|---|---|---|
| committer | Huanxuan Ao <huanxuan.ao@easystack.cn> | 2016-11-03 16:15:02 +0800 |
| commit | 23ee2fd8f060ed312a84eb03c99494e8af2ffb6f (patch) | |
| tree | 176e424ea42898da333c1f8b95daf72b23544828 /openstackclient/tests/functional/volume/v2 | |
| parent | 970b0e00053f81a313c18cc9b50bf964aa86fc20 (diff) | |
| download | python-openstackclient-23ee2fd8f060ed312a84eb03c99494e8af2ffb6f.tar.gz | |
Refactor "snapshot" commands
1.change the command name ``snapshot create/delete/list/
show/set/unset`` to ``volume snapshot create/delete/list/
show/set/unset``.
2.change the optional parameter "--name <name>" to a
positional parameter "<snapshot-name>"; Change the
positional parameter "<volume>" to a optional
parameter "--volume <volume>"
Change-Id: If03276ecdf6f0d96893d5ecf91c2aaa64929cff3
Implements: bp backup-snapshot-renamed-for-volume-resource
Co-Authored-By: Sheel Rana <ranasheel2000@gmail.com>
Diffstat (limited to 'openstackclient/tests/functional/volume/v2')
| -rw-r--r-- | openstackclient/tests/functional/volume/v2/test_snapshot.py | 32 | ||||
| -rw-r--r-- | openstackclient/tests/functional/volume/v2/test_volume.py | 10 |
2 files changed, 23 insertions, 19 deletions
diff --git a/openstackclient/tests/functional/volume/v2/test_snapshot.py b/openstackclient/tests/functional/volume/v2/test_snapshot.py index fcbc31cb..4eb69e9d 100644 --- a/openstackclient/tests/functional/volume/v2/test_snapshot.py +++ b/openstackclient/tests/functional/volume/v2/test_snapshot.py @@ -16,8 +16,8 @@ import uuid from openstackclient.tests.functional.volume.v2 import common -class SnapshotTests(common.BaseVolumeTests): - """Functional tests for snapshot. """ +class VolumeSnapshotTests(common.BaseVolumeTests): + """Functional tests for volume snapshot. """ VOLLY = uuid.uuid4().hex NAME = uuid.uuid4().hex @@ -36,24 +36,25 @@ class SnapshotTests(common.BaseVolumeTests): @classmethod def setUpClass(cls): - super(SnapshotTests, cls).setUpClass() + super(VolumeSnapshotTests, cls).setUpClass() cls.openstack('volume create --size 1 ' + cls.VOLLY) cls.wait_for_status('volume show ' + cls.VOLLY, 'available\n', 3) opts = cls.get_opts(['status']) - raw_output = cls.openstack('snapshot create --name ' + cls.NAME + - ' ' + cls.VOLLY + opts) + raw_output = cls.openstack('volume snapshot create --volume ' + + cls.VOLLY + ' ' + cls.NAME + opts) cls.assertOutput('creating\n', raw_output) - cls.wait_for_status('snapshot show ' + cls.NAME, 'available\n', 3) + cls.wait_for_status( + 'volume snapshot show ' + cls.NAME, 'available\n', 3) @classmethod def tearDownClass(cls): # Rename test raw_output = cls.openstack( - 'snapshot set --name ' + cls.OTHER_NAME + ' ' + cls.NAME) + 'volume snapshot set --name ' + cls.OTHER_NAME + ' ' + cls.NAME) cls.assertOutput('', raw_output) # Delete test raw_output_snapshot = cls.openstack( - 'snapshot delete ' + cls.OTHER_NAME) + 'volume snapshot delete ' + cls.OTHER_NAME) cls.wait_for_status('volume show ' + cls.VOLLY, 'available\n', 6) raw_output_volume = cls.openstack('volume delete --force ' + cls.VOLLY) cls.assertOutput('', raw_output_snapshot) @@ -61,26 +62,27 @@ class SnapshotTests(common.BaseVolumeTests): def test_snapshot_list(self): opts = self.get_opts(self.HEADERS) - raw_output = self.openstack('snapshot list' + opts) + raw_output = self.openstack('volume snapshot list' + opts) self.assertIn(self.NAME, raw_output) def test_snapshot_properties(self): raw_output = self.openstack( - 'snapshot set --property a=b --property c=d ' + self.NAME) + 'volume snapshot set --property a=b --property c=d ' + self.NAME) self.assertEqual("", raw_output) opts = self.get_opts(["properties"]) - raw_output = self.openstack('snapshot show ' + self.NAME + opts) + raw_output = self.openstack('volume snapshot show ' + self.NAME + opts) self.assertEqual("a='b', c='d'\n", raw_output) - raw_output = self.openstack('snapshot unset --property a ' + self.NAME) + raw_output = self.openstack( + 'volume snapshot unset --property a ' + self.NAME) self.assertEqual("", raw_output) - raw_output = self.openstack('snapshot show ' + self.NAME + opts) + raw_output = self.openstack('volume snapshot show ' + self.NAME + opts) self.assertEqual("c='d'\n", raw_output) def test_snapshot_set(self): raw_output = self.openstack( - 'snapshot set --description backup ' + self.NAME) + 'volume snapshot set --description backup ' + self.NAME) self.assertEqual("", raw_output) opts = self.get_opts(["description", "name"]) - raw_output = self.openstack('snapshot show ' + self.NAME + opts) + raw_output = self.openstack('volume snapshot show ' + self.NAME + opts) self.assertEqual("backup\n" + self.NAME + "\n", raw_output) diff --git a/openstackclient/tests/functional/volume/v2/test_volume.py b/openstackclient/tests/functional/volume/v2/test_volume.py index fb880578..ea891cba 100644 --- a/openstackclient/tests/functional/volume/v2/test_volume.py +++ b/openstackclient/tests/functional/volume/v2/test_volume.py @@ -106,11 +106,12 @@ class VolumeTests(common.BaseVolumeTests): opts = self.get_opts(self.FIELDS) # Create snapshot from test volume - raw_output = self.openstack('snapshot create ' + self.NAME + - ' --name ' + self.SNAPSHOT_NAME + opts) + raw_output = self.openstack('volume snapshot create ' + + self.SNAPSHOT_NAME + + ' --volume ' + self.NAME + opts) expected = self.SNAPSHOT_NAME + '\n' self.assertOutput(expected, raw_output) - self.wait_for("snapshot", self.SNAPSHOT_NAME, "available") + self.wait_for("volume snapshot", self.SNAPSHOT_NAME, "available") # Create volume from snapshot raw_output = self.openstack('volume create --size 2 --snapshot ' + @@ -126,7 +127,8 @@ class VolumeTests(common.BaseVolumeTests): self.assertOutput('', raw_output) # Delete test snapshot - raw_output = self.openstack('snapshot delete ' + self.SNAPSHOT_NAME) + raw_output = self.openstack( + 'volume snapshot delete ' + self.SNAPSHOT_NAME) self.assertOutput('', raw_output) self.wait_for("volume", self.NAME, "available") |
