Revision 1df0b0aa kamaki/clients/pithos/test.py
b/kamaki/clients/pithos/test.py | ||
---|---|---|
328 | 328 |
success=kwargs.pop('success', 200), |
329 | 329 |
**kwargs)) |
330 | 330 |
|
331 |
@patch('%s.set_header' % rest_pkg) |
|
332 |
@patch('%s.put' % rest_pkg, return_value=FR()) |
|
333 |
def test_container_put(self, put, SH): |
|
334 |
for pm in product( |
|
335 |
(None, 42), |
|
336 |
(None, 'v3r51on1ng'), |
|
337 |
(dict(), dict(k1='v2'), dict(k2='v2', k3='v3')), |
|
338 |
((), ('someval',)), |
|
339 |
(dict(), dict(success=400), dict(k='v', v='k'))): |
|
340 |
args, kwargs = pm[-2:] |
|
341 |
pm = pm[:-2] |
|
342 |
self.client.container_put(*(pm + args), **kwargs) |
|
343 |
quota, versioning, metas = pm[-3:] |
|
344 |
exp = [ |
|
345 |
call('X-Container-Policy-Quota', quota), |
|
346 |
call('X-Container-Policy-Versioning', versioning)] + [ |
|
347 |
call('X-Container-Meta-%s' % k, v) for k, v in metas.items()] |
|
348 |
self.assertEqual(SH.mock_calls[- len(exp):], exp) |
|
349 |
self.assertEqual(put.mock_calls[-1], call( |
|
350 |
'/%s/%s' % (self.client.account, self.client.container), |
|
351 |
*args, |
|
352 |
success=kwargs.pop('success', (201, 202)), |
|
353 |
**kwargs)) |
|
354 |
|
|
331 | 355 |
|
332 | 356 |
class Pithos(TestCase): |
333 | 357 |
|
Also available in: Unified diff