diff options
| author | Minmin Ren <renmm6@chinaunicom.cn> | 2019-05-14 02:42:30 +0000 |
|---|---|---|
| committer | Takashi Kajinami <tkajinam@redhat.com> | 2020-01-21 09:31:57 +0900 |
| commit | 14547dfb1b9aced82d5d333ab329870461034565 (patch) | |
| tree | f773193164e2153f40c4965a24af4a85d0e625d6 /cinderclient/tests/unit/v3/test_shell.py | |
| parent | 44bcd69f5a34905a63c5fa849bcfbee7b73fd56d (diff) | |
| download | python-cinderclient-4.0.3.tar.gz | |
'server_id' is not Attachment attribute, should be
set by 'instance' attribute.
v3/attachments respond body:
{"attachments":
[{"status": "attached",
"instance": INSTANCE_UUID,
"id": ATTACHMENT_UUID,
"volume_id": VOLUME_UUID,
},
...
]
}
Closes-Bug: #1860393
Change-Id: Ica5d278cb7455befe1db4be0ab65114fd606ea0a
(cherry picked from commit 03f228c11e0d88dcc396b30b7544b5cfde894750)
(cherry picked from commit 511224425804621550bf30403f7768eebe6f34ca)
Diffstat (limited to 'cinderclient/tests/unit/v3/test_shell.py')
| -rw-r--r-- | cinderclient/tests/unit/v3/test_shell.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cinderclient/tests/unit/v3/test_shell.py b/cinderclient/tests/unit/v3/test_shell.py index c9f7760..79f36a5 100644 --- a/cinderclient/tests/unit/v3/test_shell.py +++ b/cinderclient/tests/unit/v3/test_shell.py @@ -51,6 +51,7 @@ from cinderclient import client from cinderclient import exceptions from cinderclient import shell from cinderclient import utils as cinderclient_utils +from cinderclient.v3 import attachments from cinderclient.v3 import volume_snapshots from cinderclient.v3 import volumes @@ -402,6 +403,21 @@ class ShellTest(utils.TestCase): self.run_command(command) self.assert_called('GET', '/attachments%s' % expected) + @mock.patch('cinderclient.utils.print_list') + @mock.patch.object(cinderclient.v3.attachments.VolumeAttachmentManager, + 'list') + def test_attachment_list_setattr(self, mock_list, mock_print): + command = '--os-volume-api-version 3.27 attachment-list ' + fake_attachment = [attachments.VolumeAttachment(mock.ANY, attachment) + for attachment in fakes.fake_attachment_list['attachments']] + mock_list.return_value = fake_attachment + self.run_command(command) + for attach in fake_attachment: + setattr(attach, 'server_id', getattr(attach, 'instance')) + columns = ['ID', 'Volume ID', 'Status', 'Server ID'] + mock_print.assert_called_once_with(fake_attachment, columns, + sortby_index=0) + def test_revert_to_snapshot(self): original = cinderclient_utils.find_resource |
