diff options
| author | TommyLike <tommylikehu@gmail.com> | 2017-10-30 10:42:16 +0800 |
|---|---|---|
| committer | TommyLike <tommylikehu@gmail.com> | 2017-12-07 11:31:39 +0800 |
| commit | 7aedf4c898dff8e69d73da45668ec3d909f63a44 (patch) | |
| tree | b3e403839d77e02fbe2627d0d96f52ea47653a2b /cinderclient/tests | |
| parent | 91fb5b07d109c7d16dde64dffe99a63084b76dce (diff) | |
| download | python-cinderclient-7aedf4c898dff8e69d73da45668ec3d909f63a44.tar.gz | |
Support create volume from backup in client
This patch adds create volume from backup support
in cinderclient.
Change-Id: I01dbcf6b113d88732c174b848be2127ee7242b3c
Implements: blueprint support-create-volume-from-backup
Depends-On: 58d0fb327f9fc980e0c8b84dcd9f64c093285d13
Diffstat (limited to 'cinderclient/tests')
| -rw-r--r-- | cinderclient/tests/unit/v3/test_shell.py | 32 | ||||
| -rw-r--r-- | cinderclient/tests/unit/v3/test_volumes.py | 3 |
2 files changed, 33 insertions, 2 deletions
diff --git a/cinderclient/tests/unit/v3/test_shell.py b/cinderclient/tests/unit/v3/test_shell.py index 0161987..6f713ca 100644 --- a/cinderclient/tests/unit/v3/test_shell.py +++ b/cinderclient/tests/unit/v3/test_shell.py @@ -530,9 +530,39 @@ class ShellTest(utils.TestCase): 'metadata': {}, 'volume_type': '4321', 'description': None, - 'multiattach': False}} + 'multiattach': False, + 'backup_id': None}} self.assert_called_anytime('POST', '/volumes', expected) + @ddt.data({'cmd': '--os-volume-api-version 3.47 create --backup-id 1234', + 'update': {'backup_id': '1234'}}, + {'cmd': '--os-volume-api-version 3.47 create 2', + 'update': {'size': 2}} + ) + @ddt.unpack + def test_create_volume_with_backup(self, cmd, update): + self.run_command(cmd) + self.assert_called('GET', '/volumes/1234') + expected = {'volume': {'imageRef': None, + 'project_id': None, + 'status': 'creating', + 'user_id': None, + 'size': None, + 'availability_zone': None, + 'source_replica': None, + 'attach_status': 'detached', + 'source_volid': None, + 'consistencygroup_id': None, + 'name': None, + 'snapshot_id': None, + 'metadata': {}, + 'volume_type': None, + 'description': None, + 'multiattach': False, + 'backup_id': None}} + expected['volume'].update(update) + self.assert_called_anytime('POST', '/volumes', body=expected) + def test_group_list(self): self.run_command('--os-volume-api-version 3.13 group-list') self.assert_called_anytime('GET', '/groups/detail') diff --git a/cinderclient/tests/unit/v3/test_volumes.py b/cinderclient/tests/unit/v3/test_volumes.py index 75eb30f..e4b7e4a 100644 --- a/cinderclient/tests/unit/v3/test_volumes.py +++ b/cinderclient/tests/unit/v3/test_volumes.py @@ -91,7 +91,8 @@ class VolumesTest(utils.TestCase): 'source_replica': None, 'consistencygroup_id': None, 'multiattach': False, - 'group_id': '1234'}} + 'group_id': '1234', + 'backup_id': None}} cs.assert_called('POST', '/volumes', body=expected) self._assert_request_id(vol) |
