'Make sure the serializer can return 403 forbidden error instead of
500 internal server error.'

def test_download_forbidden(self):

    def get_data(*args, **kwargs):
        raise exception.Forbidden()
    self.stubs.Set(glance.api.policy.ImageProxy, 'get_data', get_data)
    request = wsgi.Request.blank('/')
    request.environ = {}
    response = webob.Response()
    response.request = request
    image = FakeImage(size=3, data=iter('ZZZ'))
    image.get_data = get_data
    self.assertRaises(webob.exc.HTTPForbidden, self.serializer.download, response, image)
