'Tests that correct response returned when deleting
a pending_delete image'

def test_delete_pending_delete_image(self):

    self.config(delayed_delete=True)
    req = webob.Request.blank(('/images/%s' % UUID2))
    req.method = 'DELETE'
    res = req.get_response(self.api)
    self.assertEqual(http_client.OK, res.status_int)
    req = webob.Request.blank(('/images/%s' % UUID2))
    req.method = 'HEAD'
    res = req.get_response(self.api)
    self.assertEqual(http_client.OK, res.status_int)
    self.assertEqual('pending_delete', res.headers['x-image-meta-status'])
    req = webob.Request.blank(('/images/%s' % UUID2))
    req.method = 'DELETE'
    res = req.get_response(self.api)
    self.assertEqual(http_client.FORBIDDEN, res.status_int)
    self.assertIn('Forbidden    to    delete    a    pending_delete    image', res.body)
    req = webob.Request.blank(('/images/%s' % UUID2))
    req.method = 'HEAD'
    res = req.get_response(self.api)
    self.assertEqual(http_client.OK, res.status_int)
    self.assertEqual('pending_delete', res.headers['x-image-meta-status'])
