Revision b4780663 kamaki/clients/test/pithos.py
b/kamaki/clients/test/pithos.py | ||
---|---|---|
313 | 313 |
self.client.upload_object(obj, tmpFile, **kwargs) |
314 | 314 |
for arg, val in kwargs.items(): |
315 | 315 |
self.assertEqual(OP.mock_calls[-2][2][arg], val) |
316 |
|
|
317 |
def test_create_object(self): |
|
318 |
PC.set_header = Mock(return_value=None) |
|
319 |
obj = 'r4nd0m0bj3c7' |
|
320 |
cont = self.client.container |
|
321 |
ctype = 'c0n73n7/typ3' |
|
322 |
exp_shd = [ |
|
323 |
call('Content-Type', 'application/octet-stream'), |
|
324 |
call('Content-length', '0'), |
|
325 |
call('Content-Type', ctype), call('Content-length', '42')] |
|
326 |
exp_put = [call('/%s/%s/%s' % (user_id, cont, obj), success=201)] * 2 |
|
327 |
with patch.object(PC, 'put', return_value=self.FR()) as put: |
|
328 |
self.client.create_object(obj) |
|
329 |
self.client.create_object(obj, |
|
330 |
content_type=ctype, content_length=42) |
|
331 |
self.assertEqual(PC.set_header.mock_calls, exp_shd) |
|
332 |
self.assertEqual(put.mock_calls, exp_put) |
Also available in: Unified diff