'Test attachment_delete with reserved.'

@mock.patch('cinder.volume.api.check_policy')
@mock.patch('cinder.volume.rpcapi.VolumeAPI.attachment_delete')
def test_attachment_delete_reserved(self, mock_rpc_attachment_delete, mock_policy):

    volume_params = {'status': 'available'}
    vref = tests_utils.create_volume(self.context, **volume_params)
    aref = self.volume_api.attachment_create(self.context, vref, fake.UUID2)
    aobj = objects.VolumeAttachment.get_by_id(self.context, aref.id)
    self.assertEqual('reserved', aref.attach_status)
    self.assertEqual(vref.id, aref.volume_id)
    self.volume_api.attachment_delete(self.context, aobj)
    mock_rpc_attachment_delete.assert_not_called()
