'Tests that the image status set to active if deletion of image fails.'

def test_image_status_when_delete_fails(self):

    fs = store.get_store_from_scheme('file')
    with mock.patch.object(fs, 'delete') as mock_fsstore_delete:
        mock_fsstore_delete.side_effect = exception.Forbidden()
        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    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('active', res.headers['x-image-meta-status'])
