'Make sure the serializer works fine.
No mater if current user is authorized to get image location if the
show_multiple_locations is False.'

def test_index_forbidden_get_image_location(self):

    class ImageLocations(object, ):
        def __len__(self):
            raise exception.Forbidden()
    self.config(show_multiple_locations=False)
    self.config(show_image_direct_url=False)
    url = '/v2/images?limit=10&sort_key=id&sort_dir=asc'
    request = webob.Request.blank(url)
    response = webob.Response(request=request)
    result = {'images': self.fixtures}
    self.assertEqual(http.OK, response.status_int)
    result['images'][0].locations = ImageLocations()
    self.serializer.index(response, result)
    self.assertEqual(http.OK, response.status_int)
