Revision e82edbb0 kamaki/clients/test/pithos.py
b/kamaki/clients/test/pithos.py | ||
---|---|---|
589 | 589 |
self.assertEqual(len(pmc[k]), v) |
590 | 590 |
else: |
591 | 591 |
self.assertEqual(pmc[k], v) |
592 |
self.assertRaises( |
|
593 |
ClientError, |
|
594 |
self.client.upload_object_unchunked, |
|
595 |
obj, tmpFile, withHashFile=True) |
|
596 |
|
|
597 |
def test_create_object_by_manifestation(self): |
|
598 |
obj = 'obj3c7N4m3' |
|
599 |
manifest = '%s/%s' % (self.client.container, obj) |
|
600 |
kwargs = dict( |
|
601 |
etag='some-etag', |
|
602 |
content_encoding='some content_encoding', |
|
603 |
content_type='some content-type', |
|
604 |
content_disposition='some content_disposition', |
|
605 |
public=True, |
|
606 |
sharing=dict(read=['u1', 'g1', 'u2'], write=['u1'])) |
|
607 |
with patch.object(PC, 'object_put', return_value=self.FR()) as put: |
|
608 |
self.client.create_object_by_manifestation(obj) |
|
609 |
expected = dict(content_length=0, manifest=manifest) |
|
610 |
for k in kwargs: |
|
611 |
expected['permissions' if k == 'sharing' else k] = None |
|
612 |
self.assertEqual(put.mock_calls[-1], call(obj, **expected)) |
|
613 |
self.client.create_object_by_manifestation(obj, **kwargs) |
|
614 |
expected.update(kwargs) |
|
615 |
expected['permissions'] = expected.pop('sharing') |
|
616 |
self.assertEqual(put.mock_calls[-1], call(obj, **expected)) |
Also available in: Unified diff