Revision c7e9c644
b/kamaki/clients/pithos/rest_api.py | ||
---|---|---|
249 | 249 |
existence queries, <key><op><value> for value queries, where <op> |
250 | 250 |
can be one of =, !=, <=, >=, <, >) |
251 | 251 |
|
252 |
:param shared: (bool) If true, only shared containers will be included
|
|
253 |
in results |
|
252 |
:param show_only_shared: (bool) If true, only shared containers will
|
|
253 |
be included in results
|
|
254 | 254 |
|
255 | 255 |
:param until: (string) optional timestamp |
256 | 256 |
|
... | ... | |
267 | 267 |
|
268 | 268 |
self._assert_container() |
269 | 269 |
|
270 |
self.set_param('format', format, iff=format) |
|
271 | 270 |
self.set_param('limit', limit, iff=limit) |
272 | 271 |
self.set_param('marker', marker, iff=marker) |
273 | 272 |
if not path: |
... | ... | |
275 | 274 |
self.set_param('delimiter', delimiter, iff=delimiter) |
276 | 275 |
else: |
277 | 276 |
self.set_param('path', path) |
277 |
self.set_param('format', format, iff=format) |
|
278 | 278 |
self.set_param('shared', iff=show_only_shared) |
279 | 279 |
if meta: |
280 | 280 |
self.set_param('meta', ','.join(meta)) |
b/kamaki/clients/pithos/test.py | ||
---|---|---|
287 | 287 |
success=kwargs.pop('success', 204), |
288 | 288 |
**kwargs)) |
289 | 289 |
|
290 |
@patch('%s.set_param' % rest_pkg) |
|
291 |
@patch('%s.set_header' % rest_pkg) |
|
292 |
@patch('%s.get' % rest_pkg, return_value=FR()) |
|
293 |
def test_container_get(self, get, SH, SP): |
|
294 |
for pm in product( |
|
295 |
(None, 42), |
|
296 |
(None, 'X'), |
|
297 |
(None, 'some/prefix'), |
|
298 |
(None, 'delimiter'), |
|
299 |
(None, '/some/path'), |
|
300 |
('json', 'some-format'), |
|
301 |
([], ['k1', 'k2', 'k3']), |
|
302 |
(False, True), |
|
303 |
(None, 'unt1l-d473'), |
|
304 |
(None, 'y37-4n47h3r'), |
|
305 |
(None, '4n47h3r-d473'), |
|
306 |
((), ('someval',)), |
|
307 |
(dict(), dict(success=400), dict(k='v', v='k'))): |
|
308 |
args, kwargs = pm[-2:] |
|
309 |
pm = pm[:-2] |
|
310 |
self.client.container_get(*(pm + args), **kwargs) |
|
311 |
lmt, mrk, prfx, dlm, path, frmt, meta, shr, unt = pm[:-2] |
|
312 |
exp = [call('limit', lmt, iff=lmt), call('marker', mrk, iff=mrk)] |
|
313 |
exp += [call('path', path)] if path else [ |
|
314 |
call('prefix', prfx, iff=prfx), |
|
315 |
call('delimiter', dlm, iff=dlm)] |
|
316 |
exp += [call('format', frmt, iff=frmt), call('shared', iff=shr)] |
|
317 |
if meta: |
|
318 |
exp += [call('meta', ','.join(meta))] |
|
319 |
exp += [call('until', unt, iff=unt)] |
|
320 |
self.assertEqual(SP.mock_calls[- len(exp):], exp) |
|
321 |
ims, ius = pm[-2:] |
|
322 |
self.assertEqual(SH.mock_calls[-2:], [ |
|
323 |
call('If-Modified-Since', ims), |
|
324 |
call('If-Unmodified-Since', ius)]) |
|
325 |
self.assertEqual(get.mock_calls[-1], call( |
|
326 |
'/%s/%s' % (self.client.account, self.client.container), |
|
327 |
*args, |
|
328 |
success=kwargs.pop('success', 200), |
|
329 |
**kwargs)) |
|
330 |
|
|
290 | 331 |
|
291 | 332 |
class Pithos(TestCase): |
292 | 333 |
|
Also available in: Unified diff