'Create a non-public image then fail to make public'

def test_publicize_image_unauthorized(self):

    rules = {'add_image': '@', 'publicize_image': '!'}
    self.set_policy_rules(rules)
    fixture_headers = {'x-image-meta-store': 'file', 'x-image-meta-disk-format': 'vhd', 'x-image-meta-is-public': 'false', 'x-image-meta-container-format': 'ovf', 'x-image-meta-name': 'fake    image    #3'}
    req = webob.Request.blank('/images')
    req.method = 'POST'
    for (k, v) in six.iteritems(fixture_headers):
        req.headers[k] = v
    res = req.get_response(self.api)
    self.assertEqual(http_client.CREATED, res.status_int)
    res_body = jsonutils.loads(res.body)['image']
    req = webob.Request.blank(('/images/%s' % res_body['id']))
    req.method = 'PUT'
    req.headers['x-image-meta-is-public'] = 'true'
    res = req.get_response(self.api)
    self.assertEqual(http_client.FORBIDDEN, res.status_int)
