How to use list_account_containers method in tempest

Best Python code snippet using tempest_python

test_account_services.py

Source:test_account_services.py Github

copy

Full Screen

...37 def test_list_containers(self):38 # list of all containers should not be empty39 params = {'format': 'json'}40 resp, container_list = \41 self.account_client.list_account_containers(params=params)42 self.assertIsNotNone(container_list)43 container_names = [c['name'] for c in container_list]44 for container_name in self.containers:45 self.assertIn(container_name, container_names)46 @attr(type='smoke')47 def test_list_containers_with_limit(self):48 # list containers one of them, half of them then all of them49 for limit in (1, self.containers_count / 2, self.containers_count):50 params = {'limit': limit}51 resp, container_list = \52 self.account_client.list_account_containers(params=params)53 self.assertEqual(len(container_list), limit)54 @attr(type='smoke')55 def test_list_containers_with_marker(self):56 # list containers using marker param57 # first expect to get 0 container as we specified last58 # the container as marker59 # second expect to get the bottom half of the containers60 params = {'marker': self.containers[-1]}61 resp, container_list = \62 self.account_client.list_account_containers(params=params)63 self.assertEqual(len(container_list), 0)64 params = {'marker': self.containers[self.containers_count / 2]}65 resp, container_list = \66 self.account_client.list_account_containers(params=params)67 self.assertEqual(len(container_list), self.containers_count / 2 - 1)68 @attr(type='smoke')69 def test_list_containers_with_end_marker(self):70 # list containers using end_marker param71 # first expect to get 0 container as we specified first container as72 # end_marker73 # second expect to get the top half of the containers74 params = {'end_marker': self.containers[0]}75 resp, container_list = \76 self.account_client.list_account_containers(params=params)77 self.assertEqual(len(container_list), 0)78 params = {'end_marker': self.containers[self.containers_count / 2]}79 resp, container_list = \80 self.account_client.list_account_containers(params=params)81 self.assertEqual(len(container_list), self.containers_count / 2)82 @attr(type='smoke')83 def test_list_containers_with_limit_and_marker(self):84 # list containers combining marker and limit param85 # result are always limitated by the limit whatever the marker86 for marker in random.choice(self.containers):87 limit = random.randint(0, self.containers_count - 1)88 params = {'marker': marker,89 'limit': limit}90 resp, container_list = \91 self.account_client.list_account_containers(params=params)92 self.assertTrue(len(container_list) <= limit, str(container_list))93 @attr(type='smoke')94 def test_list_account_metadata(self):95 # list all account metadata96 resp, metadata = self.account_client.list_account_metadata()97 self.assertIn(int(resp['status']), HTTP_SUCCESS)98 self.assertIn('x-account-object-count', resp)99 self.assertIn('x-account-container-count', resp)100 self.assertIn('x-account-bytes-used', resp)101 @attr(type='smoke')102 def test_create_and_delete_account_metadata(self):103 header = 'test-account-meta'104 data = 'Meta!'105 # add metadata to account...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful