Test for displayed volumes without attachments

A test to check that the 'Attached To' column in the Volumes table
displays a dash [-] when a particular volume is not attached
to any instances.

Closes-Bug: #1743226

Change-Id: If1d8fe5102c4924a8fedbb265083dff00197f22e
This commit is contained in:
AgnesNM 2024-06-26 11:03:31 +03:00
parent b204df05bc
commit 4a4155d96c

@ -206,6 +206,14 @@ class VolumeIndexViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
result = res.context['volumes_table'].data
self.assertCountEqual(result, expected_volumes)
def test_attachment_column(self):
column = volume_tables.AttachmentColumn("attachments")
column.table = mock.Mock()
column.table.request = mock.Mock()
volume = mock.Mock(attachments=[])
result = column.get_raw_data(volume)
self.assertIsNone(result)
class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def tearDown(self):