diff options
author | Unmesh Gurjar <unmesh.gurjar@vertex.co.in> | 2012-09-06 00:36:38 -0700 |
---|---|---|
committer | Unmesh Gurjar <unmesh.gurjar@vertex.co.in> | 2012-09-06 00:41:08 -0700 |
commit | 30d8e1b97ce0621a0ce9aae97ad8ab35101860e6 (patch) | |
tree | 89c94e634b9b6c4a3e9c56c1d0ac155bccf1d53f /tests | |
parent | 740259025528836c4bc7a1d3bc840cdebf70192a (diff) | |
download | python-glanceclient-30d8e1b97ce0621a0ce9aae97ad8ab35101860e6.tar.gz |
Specified Content-Length in update request header
While uploading a Volume to an image, the HTTPConnection's request method does
not set the Content-Length header (since the volume file is a sym link i.e. the
os.fstat call returns a st_size of 0). This causes Volume uploads to Glance
fail (since the image data is ignored as no content-length is specified).
Therefore setting the Content-Length from update( ) method if the image data is
provided.
Fixes LP: #1045824
Change-Id: If259fc5a338e3e90214a52b773132ed901691c0f
Diffstat (limited to 'tests')
-rw-r--r-- | tests/v1/test_images.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/v1/test_images.py b/tests/v1/test_images.py index 759010f..0aa8b2b 100644 --- a/tests/v1/test_images.py +++ b/tests/v1/test_images.py @@ -390,7 +390,7 @@ class ImageManagerTest(unittest.TestCase): def test_update_with_data(self): image_data = StringIO.StringIO('XXX') self.mgr.update('1', data=image_data) - expect_headers = {'x-image-meta-size': '3'} + expect_headers = {'x-image-meta-size': '3', 'Content-Length': 3} expect = [('PUT', '/v1/images/1', expect_headers, image_data)] self.assertEqual(self.api.calls, expect) |