'Test process_request for v2 api where _member_ role not able to
download the image with custom property.'

def test_v2_process_request_download_restricted(self):

    image_id = 'test1'
    extra_properties = {'x_test_key': 'test_1234'}
    def fake_get_v2_image_metadata(*args, **kwargs):
        image = ImageStub(image_id, extra_properties=extra_properties)
        request.environ['api.cache.image'] = image
        return glance.api.policy.ImageTarget(image)
    enforcer = self._enforcer_from_rules({'restricted': "not    ('test_1234':%(x_test_key)s    and    role:_member_)", 'download_image': 'role:admin    or    rule:restricted'})
    request = webob.Request.blank('/v2/images/test1/file')
    request.context = context.RequestContext(roles=['_member_'])
    cache_filter = ProcessRequestTestCacheFilter()
    cache_filter._get_v2_image_metadata = fake_get_v2_image_metadata
    cache_filter.policy = enforcer
    self.assertRaises(webob.exc.HTTPForbidden, cache_filter.process_request, request)
