Best Python code snippet using tempest_python
test_account_bulk.py
Source:test_account_bulk.py
...49 mydata = fh.read()50 resp = self.bulk_client.upload_archive(51 upload_path='', data=mydata, archive_file_format='tar')52 return resp53 def _check_contents_deleted(self, container_name):54 param = {'format': 'txt'}55 resp, body = self.account_client.list_account_containers(param)56 self.assertHeaders(resp, 'Account', 'GET')57 self.assertNotIn(container_name, body)58 @decorators.idempotent_id('a407de51-1983-47cc-9f14-47c2b059413c')59 @utils.requires_ext(extension='bulk_upload', service='object')60 def test_extract_archive(self):61 """Test bulk operation of file upload with an archived file"""62 filepath, container_name, object_name = self._create_archive()63 resp = self._upload_archive(filepath)64 self.containers.append(container_name)65 self.assertHeaders(resp.response, 'Account', 'PUT')66 param = {'format': 'json'}67 resp, body = self.account_client.list_account_containers(param)68 self.assertHeaders(resp, 'Account', 'GET')69 self.assertIn(container_name, [b['name'] for b in body])70 param = {'format': 'json'}71 resp, contents_list = self.container_client.list_container_objects(72 container_name, param)73 self.assertHeaders(resp, 'Container', 'GET')74 self.assertIn(object_name, [c['name'] for c in contents_list])75 @decorators.idempotent_id('c075e682-0d2a-43b2-808d-4116200d736d')76 @utils.requires_ext(extension='bulk_delete', service='object')77 def test_bulk_delete(self):78 """Test bulk operation of deleting multiple files"""79 filepath, container_name, object_name = self._create_archive()80 self._upload_archive(filepath)81 data = '%s/%s\n%s' % (container_name, object_name, container_name)82 resp = self.bulk_client.delete_bulk_data(data=data)83 self.assertHeaders(resp.response, 'Account', 'DELETE')84 # Check if uploaded contents are completely deleted85 self._check_contents_deleted(container_name)86 @decorators.idempotent_id('dbea2bcb-efbb-4674-ac8a-a5a0e33d1d79')87 @utils.requires_ext(extension='bulk_delete', service='object')88 def test_bulk_delete_by_POST(self):89 """Test bulk operation of deleting multiple files by HTTP POST"""90 filepath, container_name, object_name = self._create_archive()91 self._upload_archive(filepath)92 data = '%s/%s\n%s' % (container_name, object_name, container_name)93 resp = self.bulk_client.delete_bulk_data_with_post(data=data)94 self.assertHeaders(resp.response, 'Account', 'POST')95 # Check if uploaded contents are completely deleted...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!