Changes to allow image upload with V2 api

Related to bp glance-client-v2

Change-Id: I72a1d2825dd5c1ff4890e8be477cb4447d59f136
This commit is contained in:
eddie-sheffield
2013-07-31 12:21:41 -04:00
parent 937b65b513
commit e827c37a05
2 changed files with 28 additions and 0 deletions
+15
View File
@@ -105,6 +105,12 @@ fixtures = {
},
),
},
'/v2/images/606b0e88-7c5a-4d54-b5bb-046105d4de6f/file': {
'PUT': (
{},
'',
),
},
'/v2/images/5cc4bebc-db27-11e1-a1eb-080027cbe205/file': {
'GET': (
{},
@@ -355,6 +361,15 @@ class TestController(testtools.TestCase):
None)]
self.assertEqual(self.api.calls, expect)
def test_data_upload(self):
image_data = 'CCC'
image_id = '606b0e88-7c5a-4d54-b5bb-046105d4de6f'
self.controller.upload(image_id, image_data)
expect = [('PUT', '/v2/images/%s/file' % image_id,
{'Content-Type': 'application/octet-stream'},
image_data)]
self.assertEqual(self.api.calls, expect)
def test_data_without_checksum(self):
body = self.controller.data('5cc4bebc-db27-11e1-a1eb-080027cbe205',
do_checksum=False)