'Tests creates an image from copy-from with restricted sources'

def test_add_copy_from_with_restricted_sources(self):

    header_template = {'x-image-meta-store': 'file', 'x-image-meta-disk-format': 'vhd', 'x-image-meta-container-format': 'ovf', 'x-image-meta-name': 'fake    image    #F'}
    schemas = ['file:///etc/passwd', 'swift+config:///xxx', 'filesystem:///etc/passwd']
    for schema in schemas:
        req = webob.Request.blank('/images')
        req.method = 'POST'
        for (k, v) in six.iteritems(header_template):
            req.headers[k] = v
        req.headers['x-glance-api-copy-from'] = schema
        res = req.get_response(self.api)
        self.assertEqual(http_client.BAD_REQUEST, res.status_int)
