Revision 33487500 kamaki/clients/test/pithos.py

b/kamaki/clients/test/pithos.py
412 412
            prfx = 'X-Object-Meta-'
413 413
            expected = [call('%s%s' % (prfx, k), v) for k, v in metas.items()]
414 414
            self.assertEqual(PC.set_header.mock_calls, expected)
415

  
416
    def test_copy_object(self):
417
        src_cont = 'src-c0nt41n3r'
418
        src_obj = 'src-0bj'
419
        dst_cont = 'dst-c0nt41n3r'
420
        dst_obj = 'dst-0bj'
421
        expected = call(
422
            src_obj,
423
            content_length=0,
424
            source_account=None,
425
            success=201,
426
            copy_from='/%s/%s' % (src_cont, src_obj),
427
            delimiter=None,
428
            content_type=None,
429
            source_version=None,
430
            public=False)
431
        with patch.object(PC, 'object_put', return_value=self.FR()) as put:
432
            self.client.copy_object(src_cont, src_obj, dst_cont)
433
            self.assertEqual(put.mock_calls[-1], expected)
434
            self.client.copy_object(src_cont, src_obj, dst_cont, dst_obj)
435
            self.assertEqual(put.mock_calls[-1][1], (dst_obj,))
436
            kwargs = dict(
437
                source_version='src-v3r510n',
438
                source_account='src-4cc0un7',
439
                public=True,
440
                content_type='c0n73n7Typ3',
441
                delimiter='5')
442
            self.client.copy_object(src_cont, src_obj, dst_cont, **kwargs)
443
            for k, v in kwargs.items():
444
                self.assertEqual(v, put.mock_calls[-1][2][k])

Also available in: Unified diff