Revision aa9c7402
b/kamaki/clients/pithos/test.py | ||
---|---|---|
336 | 336 |
for arg, val in kwargs.items(): |
337 | 337 |
self.assertEqual(OP.mock_calls[-2][2][arg], val) |
338 | 338 |
|
339 |
@patch('%s.put' % pithos_pkg, return_value=FR()) |
|
340 |
@patch('%s.set_header' % client_pkg) |
|
341 |
def test_create_directory(self, SH, put): |
|
342 |
cont = self.client.container |
|
343 |
exp_shd = [ |
|
344 |
call('Content-Type', 'application/directory'), |
|
345 |
call('Content-length', '0')] |
|
346 |
exp_put = [call('/%s/%s/%s' % (user_id, cont, obj), success=201)] |
|
347 |
self.client.create_directory(obj) |
|
348 |
self.assertEqual(PC.set_header.mock_calls, exp_shd) |
|
349 |
self.assertEqual(put.mock_calls, exp_put) |
|
350 |
|
|
351 | 339 |
def test_get_object_info(self): |
352 | 340 |
FR.headers = object_info |
353 | 341 |
version = 'v3r510n' |
... | ... | |
359 | 347 |
call(obj, version=None), |
360 | 348 |
call(obj, version=version)]) |
361 | 349 |
with patch.object( |
362 |
PC, |
|
363 |
'object_head', |
|
350 |
PC, 'object_head', |
|
364 | 351 |
side_effect=ClientError('Obj not found', 404)): |
365 | 352 |
self.assertRaises( |
366 | 353 |
ClientError, |
b/kamaki/clients/storage/test.py | ||
---|---|---|
316 | 316 |
self.assertEqual(SH.mock_calls, exp_shd) |
317 | 317 |
self.assertEqual(put.mock_calls, exp_put) |
318 | 318 |
|
319 |
"""
|
|
320 |
def test_get_object_info(self): |
|
319 |
@patch('%s.head' % storage_pkg, return_value=FR())
|
|
320 |
def test_get_object_info(self, head):
|
|
321 | 321 |
FR.headers = object_info |
322 |
version = 'v3r510n' |
|
323 |
with patch.object(PC, 'object_head', return_value=FR()) as head: |
|
324 |
r = self.client.get_object_info(obj) |
|
325 |
self.assertEqual(r, object_info) |
|
326 |
r = self.client.get_object_info(obj, version=version) |
|
327 |
self.assertEqual(head.mock_calls, [ |
|
328 |
call(obj, version=None), |
|
329 |
call(obj, version=version)]) |
|
330 |
with patch.object( |
|
331 |
PC, |
|
332 |
'object_head', |
|
333 |
side_effect=ClientError('Obj not found', 404)): |
|
334 |
self.assertRaises( |
|
335 |
ClientError, |
|
336 |
self.client.get_object_info, |
|
337 |
obj, version=version) |
|
322 |
path = '/%s/%s/%s' % (self.client.account, self.client.container, obj) |
|
323 |
r = self.client.get_object_info(obj) |
|
324 |
self.assertEqual(r, object_info) |
|
325 |
self.assertEqual(head.mock_calls[-1], call(path, success=200)) |
|
338 | 326 |
|
327 |
""" |
|
339 | 328 |
@patch('%s.get_object_info' % pithos_pkg, return_value=object_info) |
340 | 329 |
def test_get_object_meta(self, GOI): |
341 | 330 |
expected = dict() |
Also available in: Unified diff