'We test that caching is no longer broken for remote images'

@skip_if_disabled
def test_cache_remote_image(self):

    self.cleanup()
    self.start_servers(**self.__dict__.copy())
    setup_http(self)
    remote_uri = get_http_uri(self, '2')
    headers = {'X-Image-Meta-Name': 'Image2', 'X-Image-Meta-disk_format': 'raw', 'X-Image-Meta-container_format': 'ovf', 'X-Image-Meta-Is-Public': 'True', 'X-Image-Meta-Location': remote_uri}
    path = ('http://%s:%d/v1/images' % ('127.0.0.1', self.api_port))
    http = httplib2.Http()
    (response, content) = http.request(path, 'POST', headers=headers)
    self.assertEqual(http_client.CREATED, response.status)
    data = jsonutils.loads(content)
    self.assertEqual(FIVE_KB, data['image']['size'])
    image_id = data['image']['id']
    path = ('http://%s:%d/v1/images/%s' % ('127.0.0.1', self.api_port, image_id))
    http = httplib2.Http()
    (response, content) = http.request(path, 'GET')
    self.assertEqual(http_client.OK, response.status)
    http = httplib2.Http()
    (response, content) = http.request(path, 'GET')
    self.assertEqual(http_client.OK, response.status)
    self.assertEqual(FIVE_KB, int(response['content-length']))
    self.stop_servers()
