def test__get_attachment_id(self): expectation = 'meow' attached_vol = mock.Mock(attachments=[ {'server_id': self.node.instance_uuid, 'attachment_id': 'meow'}]) attached_vol2 = mock.Mock(attachments=[ {'server_id': self.node.uuid, 'attachment_id': 'meow'}]) unattached = mock.Mock(attachments=[]) no_attachment = mock.Mock(attachments=[ {'server_id': 'cat', 'id': 'cat'}]) self.assertEqual(expectation, cinder._get_attachment_id(self.node, attached_vol)) self.assertEqual(expectation, cinder._get_attachment_id(self.node, attached_vol2)) self.assertIsNone(cinder._get_attachment_id(self.node, unattached)) self.assertIsNone(cinder._get_attachment_id(self.node, no_attachment))
def test__get_attachment_id(self): expectation = 'meow' attached_vol = mock.Mock(attachments=[ {'server_id': self.node.instance_uuid, 'attachment_id': 'meow'}]) attached_vol2 = mock.Mock(attachments=[ {'server_id': self.node.uuid, 'attachment_id': 'meow'}]) unattached = mock.Mock(attachments=[]) no_attachment = mock.Mock(attachments=[ {'server_id': 'cat', 'id': 'cat'}]) self.assertEqual(expectation, cinder._get_attachment_id(self.node, attached_vol)) self.assertEqual(expectation, cinder._get_attachment_id(self.node, attached_vol2)) self.assertIsNone(cinder._get_attachment_id(self.node, unattached)) self.assertIsNone(cinder._get_attachment_id(self.node, no_attachment))