diff options
| author | Zuul <zuul@review.opendev.org> | 2022-11-29 20:49:48 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2022-11-29 20:49:48 +0000 |
| commit | 92a1c854bbe22ad57807268014f5583b53a158de (patch) | |
| tree | 08a591c69a5e81bbffba251cd8b8fdaff515a06b /openstackclient/tests/unit | |
| parent | 948198643f84c0a41ad6c1935214c9627376712d (diff) | |
| parent | 4710cbeca6638cc78880f2c4fc22d74aa7bb7c41 (diff) | |
| download | python-openstackclient-92a1c854bbe22ad57807268014f5583b53a158de.tar.gz | |
Merge "Add test for creating volume from source"
Diffstat (limited to 'openstackclient/tests/unit')
| -rw-r--r-- | openstackclient/tests/unit/volume/v2/test_volume.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/volume/v2/test_volume.py b/openstackclient/tests/unit/volume/v2/test_volume.py index ef9c2fab..c930002f 100644 --- a/openstackclient/tests/unit/volume/v2/test_volume.py +++ b/openstackclient/tests/unit/volume/v2/test_volume.py @@ -398,6 +398,43 @@ class TestVolumeCreate(TestVolume): parsed_args) self.assertIn("--os-volume-api-version 3.47 or greater", str(exc)) + def test_volume_create_with_source_volume(self): + source_vol = "source_vol" + arglist = [ + '--source', self.new_volume.id, + source_vol, + ] + verifylist = [ + ('source', self.new_volume.id), + ('name', source_vol), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + self.volumes_mock.get.return_value = self.new_volume + + # In base command class ShowOne in cliff, abstract method take_action() + # returns a two-part tuple with a tuple of column names and a tuple of + # data to be shown. + columns, data = self.cmd.take_action(parsed_args) + + self.volumes_mock.create.assert_called_once_with( + size=self.new_volume.size, + snapshot_id=None, + name=source_vol, + description=None, + volume_type=None, + availability_zone=None, + metadata=None, + imageRef=None, + source_volid=self.new_volume.id, + consistencygroup_id=None, + scheduler_hints=None, + backup_id=None, + ) + + self.assertEqual(self.columns, columns) + self.assertCountEqual(self.datalist, data) + def test_volume_create_with_bootable_and_readonly(self): arglist = [ '--bootable', |
