Revision e3b8f796

b/kamaki/clients/pithos/test.py
428 428
        for k, v in kwargs.items():
429 429
            self.assertEqual(v, put.mock_calls[-1][2][k])
430 430

  
431
    @patch('%s.get' % pithos_pkg, return_value=FR())
432
    @patch('%s.set_param' % pithos_pkg)
433
    def test_list_objects(self, SP, get):
434
        FR.json = object_list
435
        acc = self.client.account
436
        cont = self.client.container
437
        SP = PC.set_param
438
        r = self.client.list_objects()
439
        for i in range(len(r)):
440
            self.assert_dicts_are_equal(r[i], object_list[i])
441
        self.assertEqual(get.mock_calls, [
442
            call('/%s/%s' % (acc, cont), success=(200, 204, 304, 404))])
443
        self.assertEqual(SP.mock_calls, [call('format', 'json')])
444
        FR.status_code = 304
445
        self.assertEqual(self.client.list_objects(), [])
446
        FR.status_code = 404
447
        self.assertRaises(ClientError, self.client.list_objects)
448

  
449
    @patch('%s.get' % pithos_pkg, return_value=FR())
450
    @patch('%s.set_param' % pithos_pkg)
451
    def test_list_objects_in_path(self, SP, get):
452
        FR.json = object_list
453
        path = '/some/awsome/path'
454
        acc = self.client.account
455
        cont = self.client.container
456
        SP = PC.set_param
457
        self.client.list_objects_in_path(path)
458
        self.assertEqual(get.mock_calls, [
459
            call('/%s/%s' % (acc, cont), success=(200, 204, 404))])
460
        self.assertEqual(SP.mock_calls, [
461
            call('format', 'json'), call('path', path)])
462
        FR.status_code = 404
463
        self.assertRaises(ClientError, self.client.list_objects)
464

  
465 431
    #  Pithos+ only methods
466 432

  
467 433
    @patch('%s.container_delete' % pithos_pkg, return_value=FR())
b/kamaki/clients/storage/test.py
418 418
        FR.status_code = 404
419 419
        self.assertRaises(ClientError, self.client.list_objects)
420 420

  
421
    """
422 421
    @patch('%s.get' % client_pkg, return_value=FR())
423 422
    @patch('%s.set_param' % client_pkg)
424 423
    def test_list_objects_in_path(self, SP, get):
425 424
        FR.json = object_list
426 425
        path = '/some/awsome/path'
427
        acc = self.client.account
428
        cont = self.client.container
429
        SP = PC.set_param
426
        acc, cont = self.client.account, self.client.container
430 427
        self.client.list_objects_in_path(path)
431
        self.assertEqual(get.mock_calls, [
432
            call('/%s/%s' % (acc, cont), success=(200, 204, 404))])
428
        self.assertEqual(
429
            get.mock_calls[-1],
430
            call('/%s/%s' % (acc, cont), success=(200, 204, 404)))
433 431
        self.assertEqual(SP.mock_calls, [
434 432
            call('format', 'json'), call('path', path)])
435 433
        FR.status_code = 404
436 434
        self.assertRaises(ClientError, self.client.list_objects)
437
    """
438 435

  
439 436
if __name__ == '__main__':
440 437
    from sys import argv

Also available in: Unified diff