368 |
368 |
expected = call(obj, update=True, metadata={metakey: ''})
|
369 |
369 |
self.assertEqual(post.mock_calls[-1], expected)
|
370 |
370 |
|
371 |
|
@patch('%s.post' % pithos_pkg, return_value=FR())
|
372 |
|
@patch('%s.set_header' % pithos_pkg)
|
373 |
|
def test_replace_object_meta(self, SH, post):
|
374 |
|
metas = dict(k1='new1', k2='new2', k3='new3')
|
375 |
|
cont = self.client.container
|
376 |
|
self.client.replace_object_meta(metas)
|
377 |
|
expected = call('/%s/%s' % (user_id, cont), success=202)
|
378 |
|
self.assertEqual(post.mock_calls[-1], expected)
|
379 |
|
prfx = 'X-Object-Meta-'
|
380 |
|
expected = [call('%s%s' % (prfx, k), v) for k, v in metas.items()]
|
381 |
|
self.assertEqual(PC.set_header.mock_calls, expected)
|
382 |
|
|
383 |
371 |
@patch('%s.object_put' % pithos_pkg, return_value=FR())
|
384 |
372 |
def test_copy_object(self, put):
|
385 |
373 |
src_cont = 'src-c0nt41n3r'
|
... | ... | |
440 |
428 |
for k, v in kwargs.items():
|
441 |
429 |
self.assertEqual(v, put.mock_calls[-1][2][k])
|
442 |
430 |
|
443 |
|
@patch('%s.delete' % pithos_pkg, return_value=FR())
|
444 |
|
def test_delete_object(self, delete):
|
445 |
|
cont = self.client.container
|
446 |
|
self.client.delete_object(obj)
|
447 |
|
self.assertEqual(
|
448 |
|
delete.mock_calls[-1],
|
449 |
|
call('/%s/%s/%s' % (user_id, cont, obj), success=(204, 404)))
|
450 |
|
FR.status_code = 404
|
451 |
|
self.assertRaises(ClientError, self.client.delete_object, obj)
|
452 |
|
|
453 |
431 |
@patch('%s.get' % pithos_pkg, return_value=FR())
|
454 |
432 |
@patch('%s.set_param' % pithos_pkg)
|
455 |
433 |
def test_list_objects(self, SP, get):
|