Revision 723e9d47 kamaki/clients/test/pithos.py
b/kamaki/clients/test/pithos.py | ||
---|---|---|
66 | 66 |
'x-container-object-meta': '', |
67 | 67 |
'x-container-policy-quota': 53687091200, |
68 | 68 |
'x-container-policy-versioning': 'auto'} |
69 |
object_info = { |
|
70 |
'content-language': 'en-us', |
|
71 |
'content-length': 254965, |
|
72 |
'content-type': 'application/octet-stream', |
|
73 |
'date': 'Thu, 07 Mar 2013 13:27:43 GMT', |
|
74 |
'etag': '', |
|
75 |
'last-modified': 'Mon, 04 Mar 2013 18:22:31 GMT', |
|
76 |
'server': 'gunicorn/0.14.5', |
|
77 |
'vary': 'Accept-Language', |
|
78 |
'x-object-hash': 'obj3c7h45h1s0bj3c7h45h411r34dY', |
|
79 |
'x-object-uuid': 'd0c747ca-34bd-49e0-8e98-1d07d8b0cbc7', |
|
80 |
'x-object-version': '525996', |
|
81 |
'x-object-version-timestamp': 'Mon, 04 Mar 2013 18:22:31 GMT'} |
|
69 | 82 |
container_list = [ |
70 | 83 |
dict( |
71 | 84 |
count=2, |
... | ... | |
343 | 356 |
self.client.create_directory(obj) |
344 | 357 |
self.assertEqual(PC.set_header.mock_calls, exp_shd) |
345 | 358 |
self.assertEqual(put.mock_calls, exp_put) |
359 |
|
|
360 |
def test_get_object_info(self): |
|
361 |
self.FR.headers = object_info |
|
362 |
obj = 'r4nd0m0bj3c7' |
|
363 |
version = 'v3r510n' |
|
364 |
with patch.object(PC, 'object_head', return_value=self.FR()) as head: |
|
365 |
r = self.client.get_object_info(obj) |
|
366 |
self.assertEqual(r, object_info) |
|
367 |
r = self.client.get_object_info(obj, version=version) |
|
368 |
self.assertEqual(head.mock_calls, [ |
|
369 |
call(obj, version=None), |
|
370 |
call(obj, version=version)]) |
|
371 |
with patch.object( |
|
372 |
PC, |
|
373 |
'object_head', |
|
374 |
side_effect=ClientError('Obj not found', 404)): |
|
375 |
self.assertRaises( |
|
376 |
ClientError, |
|
377 |
self.client.get_object_info, |
|
378 |
obj, version=version) |
Also available in: Unified diff