Revision 7b6e977c kamaki/clients/image/test.py
b/kamaki/clients/image/test.py | ||
---|---|---|
35 | 35 |
from unittest import TestCase |
36 | 36 |
from itertools import product |
37 | 37 |
|
38 |
example_image_headers = { |
|
39 |
'x-image-meta-id': '3edd4d15-41b4-4a39-9601-015ef56b3bb3', |
|
40 |
'x-image-meta-checksum': 'df23837c30889252c0aed80b6f770a53a86', |
|
41 |
'x-image-meta-container-format': 'bare', |
|
42 |
'x-image-meta-location': 'pithos://a13528163db/con/obj_13.0', |
|
43 |
'x-image-meta-disk-format': 'diskdump', |
|
44 |
'x-image-meta-is-public': 'True', |
|
45 |
'x-image-meta-status': 'available', |
|
46 |
'x-image-meta-deleted-at': '', |
|
47 |
'x-image-meta-updated-at': '2013-04-11 15:22:39', |
|
48 |
'x-image-meta-created-at': '2013-04-11 15:22:37', |
|
49 |
'x-image-meta-owner': 'a13529bb3c3db', |
|
50 |
'x-image-meta-size': '1073741824', |
|
51 |
'x-image-meta-name': 'img_1365686546.0', |
|
52 |
'extraheaders': 'should be ignored' |
|
53 |
} |
|
38 | 54 |
example_images = [ |
39 | 55 |
{ |
40 | 56 |
"status": "available", |
... | ... | |
185 | 201 |
@patch('%s.post' % image_pkg, return_value=FR()) |
186 | 202 |
def test_register(self, post, SH): |
187 | 203 |
img0 = example_images_detailed[0] |
204 |
FR.headers = example_image_headers |
|
188 | 205 |
img0_location = img0['location'] |
189 | 206 |
img0_name = 'A new img0 name' |
190 | 207 |
prfx = 'x-image-meta-' |
... | ... | |
206 | 223 |
async_headers['%s%s' % (prfx, k)] = args[i] |
207 | 224 |
props['%s%s' % (proprfx, args[i])] = k |
208 | 225 |
async_headers.update(props) |
209 |
self.client.register( |
|
226 |
r = self.client.register(
|
|
210 | 227 |
img0_name, img0_location, |
211 | 228 |
params=params, properties=props) |
229 |
expectedict = dict(example_image_headers) |
|
230 |
expectedict.pop('extraheaders') |
|
231 |
self.assert_dicts_are_equal(expectedict, r) |
|
212 | 232 |
self.assertEqual( |
213 | 233 |
post.mock_calls[-1], |
214 | 234 |
call('/images/', async_headers=async_headers, success=200)) |
Also available in: Unified diff