Revision 524d9cdd
b/kamaki/clients/pithos/__init__.py | ||
---|---|---|
204 | 204 |
format='json', |
205 | 205 |
hashmap=True, |
206 | 206 |
content_type=None, |
207 |
etag=None, |
|
208 | 207 |
content_encoding=None, |
209 | 208 |
content_disposition=None, |
210 | 209 |
permissions=None, |
... | ... | |
216 | 215 |
hashmap=True, |
217 | 216 |
content_type=content_type, |
218 | 217 |
json=json, |
219 |
etag=etag, |
|
220 | 218 |
content_encoding=content_encoding, |
221 | 219 |
content_disposition=content_disposition, |
222 | 220 |
permissions=permissions, |
... | ... | |
293 | 291 |
hash_cb=None, |
294 | 292 |
upload_cb=None, |
295 | 293 |
etag=None, |
294 |
if_not_exist=None, |
|
296 | 295 |
content_encoding=None, |
297 | 296 |
content_disposition=None, |
298 | 297 |
content_type=None, |
... | ... | |
310 | 309 |
|
311 | 310 |
:param etag: (str) |
312 | 311 |
|
312 |
:param if_not_exist: (bool) If true, the file will be uploaded ONLY if |
|
313 |
it does not exist remotely, otherwise the operation will fail. |
|
314 |
Involves the case of an object with the same path is created while |
|
315 |
the object is being uploaded. |
|
316 |
|
|
313 | 317 |
:param content_encoding: (str) |
314 | 318 |
|
315 | 319 |
:param content_disposition: (str) |
... | ... | |
342 | 346 |
obj, hashmap, |
343 | 347 |
content_type=content_type, |
344 | 348 |
size=size, |
345 |
etag=etag, |
|
346 | 349 |
content_encoding=content_encoding, |
347 | 350 |
content_disposition=content_disposition, |
348 | 351 |
permissions=sharing, |
... | ... | |
393 | 396 |
format='json', |
394 | 397 |
hashmap=True, |
395 | 398 |
content_type=content_type, |
399 |
if_etag_not_match='*' if if_not_exist else None, |
|
400 |
etag=etag, |
|
396 | 401 |
json=hashmap, |
397 | 402 |
success=201) |
398 | 403 |
|
b/kamaki/clients/pithos/test.py | ||
---|---|---|
835 | 835 |
json=dict( |
836 | 836 |
hashes=['s0m3h@5h'] * num_of_blocks, |
837 | 837 |
bytes=num_of_blocks * 4 * 1024 * 1024), |
838 |
etag=None, |
|
839 | 838 |
content_encoding=None, |
840 | 839 |
content_type='application/octet-stream', |
841 | 840 |
content_disposition=None, |
... | ... | |
911 | 910 |
tmpFile.seek(0) |
912 | 911 |
kwargs = dict( |
913 | 912 |
etag='s0m3E74g', |
913 |
if_not_exist=True, |
|
914 | 914 |
content_type=ctype, |
915 | 915 |
content_disposition=ctype + 'd15p051710n', |
916 | 916 |
public=True, |
917 | 917 |
content_encoding='802.11') |
918 | 918 |
self.client.upload_object(obj, tmpFile, **kwargs) |
919 |
kwargs.pop('if_not_exist') |
|
920 |
etag = kwargs.pop('etag') |
|
919 | 921 |
for arg, val in kwargs.items(): |
920 | 922 |
self.assertEqual(OP.mock_calls[-2][2][arg], val) |
923 |
self.assertEqual(OP.mock_calls[-1][2]['if_etag_not_match'], '*') |
|
924 |
self.assertEqual(OP.mock_calls[-1][2]['etag'], etag) |
|
921 | 925 |
|
922 | 926 |
def test_get_object_info(self): |
923 | 927 |
FR.headers = object_info |
Also available in: Unified diff