summaryrefslogtreecommitdiff
path: root/cinderclient/tests/unit/v3/test_shell.py
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-02-19 17:14:51 +0000
committerGerrit Code Review <review@openstack.org>2020-02-19 17:14:51 +0000
commit61fb7b4452d0d5d42cf5d5e569e5d25e06627fcc (patch)
tree529cea0e958c0cd100042d251a10359001a83e4f /cinderclient/tests/unit/v3/test_shell.py
parent17555ff0f8e3e838cdce3972b8eba44dcbb8e5d0 (diff)
parent522e5a938bb478ec190e741a0d47eb16f8c4af00 (diff)
downloadpython-cinderclient-queens-eol.tar.gz
Merge "Add missed 'Server ID' output in attachment-list" into stable/queensqueens-eolstable/queens
Diffstat (limited to 'cinderclient/tests/unit/v3/test_shell.py')
-rw-r--r--cinderclient/tests/unit/v3/test_shell.py16
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 ae15587..cdc70e9 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
@@ -336,6 +337,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