'Test process_response for v1 api where registry raises NotFound
exception as image metadata not found.'

def test_v1_process_response_image_meta_not_found(self):

    image_id = 'test1'
    def fake_fetch_request_info(*args, **kwargs):
        return ('test1', 'GET', 'v1')
    def fake_get_v1_image_metadata(*args, **kwargs):
        raise exception.NotFound()
    cache_filter = ProcessRequestTestCacheFilter()
    cache_filter._fetch_request_info = fake_fetch_request_info
    self.stubs.Set(registry, 'get_image_metadata', fake_get_v1_image_metadata)
    rules = {'restricted': "not    ('test_1234':%(x_test_key)s    and    role:_member_)", 'download_image': 'role:admin    or    rule:restricted'}
    self.set_policy_rules(rules)
    cache_filter.policy = glance.api.policy.Enforcer()
    request = webob.Request.blank(('/v1/images/%s' % image_id))
    request.context = context.RequestContext(roles=['_member_'])
    resp = webob.Response(request=request)
    self.assertRaises(webob.exc.HTTPNotFound, cache_filter.process_response, resp)
