Revision fa27f71a
b/kamaki/clients/pithos/rest_api.py | ||
---|---|---|
391 | 391 |
return self.delete(path, *args, success=success, **kwargs) |
392 | 392 |
|
393 | 393 |
def object_head( |
394 |
self, object,
|
|
394 |
self, obj, |
|
395 | 395 |
version=None, |
396 | 396 |
if_etag_match=None, |
397 | 397 |
if_etag_not_match=None, |
... | ... | |
430 | 430 |
self.set_header('If-Modified-Since', if_modified_since) |
431 | 431 |
self.set_header('If-Unmodified-Since', if_unmodified_since) |
432 | 432 |
|
433 |
path = path4url(self.account, self.container, object)
|
|
433 |
path = path4url(self.account, self.container, obj) |
|
434 | 434 |
success = kwargs.pop('success', 200) |
435 | 435 |
return self.head(path, *args, success=success, **kwargs) |
436 | 436 |
|
b/kamaki/clients/pithos/test.py | ||
---|---|---|
412 | 412 |
success=kwargs.pop('success', 204), |
413 | 413 |
**kwargs)) |
414 | 414 |
|
415 |
@patch('%s.set_param' % rest_pkg) |
|
416 |
@patch('%s.set_header' % rest_pkg) |
|
417 |
@patch('%s.head' % rest_pkg, return_value=FR()) |
|
418 |
def test_object_head(self, head, SH, SP): |
|
419 |
for pm in product( |
|
420 |
(None, 'v3r510n'), |
|
421 |
(None, '1f-374g'), |
|
422 |
(None, '1f-n0-74g'), |
|
423 |
(None, '1f-m0d-51nc3'), |
|
424 |
(None, '1f-unm0d-51nc3'), |
|
425 |
((), ('someval',)), |
|
426 |
(dict(), dict(success=400), dict(k='v', v='k'))): |
|
427 |
args, kwargs = pm[-2:] |
|
428 |
pm = pm[:-2] |
|
429 |
self.client.object_head(obj, *(pm + args), **kwargs) |
|
430 |
vrs, etag, netag, ims, ius = pm[:5] |
|
431 |
self.assertEqual( |
|
432 |
SP.mock_calls[-1], |
|
433 |
call('version', vrs, iff=vrs)) |
|
434 |
self.assertEqual(SH.mock_calls[-4:], [ |
|
435 |
call('If-Match', etag), |
|
436 |
call('If-None-Match', netag), |
|
437 |
call('If-Modified-Since', ims), |
|
438 |
call('If-Unmodified-Since', ius)]) |
|
439 |
acc, cont = self.client.account, self.client.container |
|
440 |
self.assertEqual(head.mock_calls[-1], call( |
|
441 |
'/%s/%s/%s' % (acc, cont, obj), |
|
442 |
*args, |
|
443 |
success=kwargs.pop('success', 200), |
|
444 |
**kwargs)) |
|
445 |
|
|
415 | 446 |
|
416 | 447 |
class Pithos(TestCase): |
417 | 448 |
|
Also available in: Unified diff