summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-12-13 22:58:16 +0000
committerGerrit Code Review <review@openstack.org>2016-12-13 22:58:16 +0000
commit86cad34c5bc93d1539069b33b6f32ace3525ee7c (patch)
treed26cabc88cabc40db051b17f1d0c3732838f5c1f /openstackclient/tests
parent5bc2cf231d756331325bb520d1e6f28b407c493e (diff)
parent7357b24d3a63be612aa32c901e15424ff92beca0 (diff)
downloadpython-openstackclient-86cad34c5bc93d1539069b33b6f32ace3525ee7c.tar.gz
Merge "Add "--remote-source" option to "volume snapshot create" command"
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/unit/volume/v2/test_snapshot.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/volume/v2/test_snapshot.py b/openstackclient/tests/unit/volume/v2/test_snapshot.py
index cedf21a9..8ce356ae 100644
--- a/openstackclient/tests/unit/volume/v2/test_snapshot.py
+++ b/openstackclient/tests/unit/volume/v2/test_snapshot.py
@@ -67,6 +67,7 @@ class TestSnapshotCreate(TestSnapshot):
self.volumes_mock.get.return_value = self.volume
self.snapshots_mock.create.return_value = self.new_snapshot
+ self.snapshots_mock.manage.return_value = self.new_snapshot
# Get the command object to test
self.cmd = volume_snapshot.CreateVolumeSnapshot(self.app, None)
@@ -152,6 +153,33 @@ class TestSnapshotCreate(TestSnapshot):
self.assertEqual(self.columns, columns)
self.assertEqual(self.data, data)
+ def test_snapshot_create_without_remote_source(self):
+ arglist = [
+ '--remote-source', 'source-name=test_source_name',
+ '--remote-source', 'source-id=test_source_id',
+ '--volume', self.new_snapshot.volume_id,
+ ]
+ ref_dict = {'source-name': 'test_source_name',
+ 'source-id': 'test_source_id'}
+ verifylist = [
+ ('remote_source', ref_dict),
+ ('volume', self.new_snapshot.volume_id),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ columns, data = self.cmd.take_action(parsed_args)
+
+ self.snapshots_mock.manage.assert_called_with(
+ volume_id=self.new_snapshot.volume_id,
+ ref=ref_dict,
+ name=None,
+ description=None,
+ metadata=None,
+ )
+ self.snapshots_mock.create.assert_not_called()
+ self.assertEqual(self.columns, columns)
+ self.assertEqual(self.data, data)
+
class TestSnapshotDelete(TestSnapshot):