Best Python code snippet using tempest_python
test_account_services.py
Source:test_account_services.py
...229 # list all account metadata230 # set metadata to account231 metadata = {'test-account-meta1': 'Meta1',232 'test-account-meta2': 'Meta2'}233 resp, _ = self.account_client.create_update_or_delete_account_metadata(234 create_update_metadata=metadata)235 resp, _ = self.account_client.list_account_metadata()236 self.assertHeaders(resp, 'Account', 'HEAD')237 self.assertIn('x-account-meta-test-account-meta1', resp)238 self.assertIn('x-account-meta-test-account-meta2', resp)239 self.account_client.create_update_or_delete_account_metadata(240 delete_metadata=metadata)241 @decorators.idempotent_id('b904c2e3-24c2-4dba-ad7d-04e90a761be5')242 def test_list_no_account_metadata(self):243 # list no account metadata244 resp, _ = self.account_client.list_account_metadata()245 self.assertHeaders(resp, 'Account', 'HEAD')246 self.assertNotIn('x-account-meta-', str(resp))247 @decorators.idempotent_id('e2a08b5f-3115-4768-a3ee-d4287acd6c08')248 def test_update_account_metadata_with_create_metadata(self):249 # add metadata to account250 metadata = {'test-account-meta1': 'Meta1'}251 resp, _ = self.account_client.create_update_or_delete_account_metadata(252 create_update_metadata=metadata)253 self.assertHeaders(resp, 'Account', 'POST')254 resp, _ = self.account_client.list_account_metadata()255 self.assertIn('x-account-meta-test-account-meta1', resp)256 self.assertEqual(resp['x-account-meta-test-account-meta1'],257 metadata['test-account-meta1'])258 self.account_client.create_update_or_delete_account_metadata(259 delete_metadata=metadata)260 @decorators.idempotent_id('9f60348d-c46f-4465-ae06-d51dbd470953')261 def test_update_account_metadata_with_delete_metadata(self):262 # delete metadata from account263 metadata = {'test-account-meta1': 'Meta1'}264 self.account_client.create_update_or_delete_account_metadata(265 create_update_metadata=metadata)266 resp, _ = self.account_client.create_update_or_delete_account_metadata(267 delete_metadata=metadata)268 self.assertHeaders(resp, 'Account', 'POST')269 resp, _ = self.account_client.list_account_metadata()270 self.assertNotIn('x-account-meta-test-account-meta1', resp)271 @decorators.idempotent_id('64fd53f3-adbd-4639-af54-436e4982dbfb')272 def test_update_account_metadata_with_create_metadata_key(self):273 # if the value of metadata is not set, the metadata is not274 # registered at a server275 metadata = {'test-account-meta1': ''}276 resp, _ = self.account_client.create_update_or_delete_account_metadata(277 create_update_metadata=metadata)278 self.assertHeaders(resp, 'Account', 'POST')279 resp, _ = self.account_client.list_account_metadata()280 self.assertNotIn('x-account-meta-test-account-meta1', resp)281 @decorators.idempotent_id('d4d884d3-4696-4b85-bc98-4f57c4dd2bf1')282 def test_update_account_metadata_with_delete_metadata_key(self):283 # Although the value of metadata is not set, the feature of284 # deleting metadata is valid285 metadata_1 = {'test-account-meta1': 'Meta1'}286 self.account_client.create_update_or_delete_account_metadata(287 create_update_metadata=metadata_1)288 metadata_2 = {'test-account-meta1': ''}289 resp, _ = self.account_client.create_update_or_delete_account_metadata(290 delete_metadata=metadata_2)291 self.assertHeaders(resp, 'Account', 'POST')292 resp, _ = self.account_client.list_account_metadata()293 self.assertNotIn('x-account-meta-test-account-meta1', resp)294 @decorators.idempotent_id('8e5fc073-59b9-42ee-984a-29ed11b2c749')295 def test_update_account_metadata_with_create_and_delete_metadata(self):296 # Send a request adding and deleting metadata requests simultaneously297 metadata_1 = {'test-account-meta1': 'Meta1'}298 self.account_client.create_update_or_delete_account_metadata(299 create_update_metadata=metadata_1)300 metadata_2 = {'test-account-meta2': 'Meta2'}301 resp, _ = (302 self.account_client.create_update_or_delete_account_metadata(303 create_update_metadata=metadata_2,304 delete_metadata=metadata_1))305 self.assertHeaders(resp, 'Account', 'POST')306 resp, _ = self.account_client.list_account_metadata()307 self.assertNotIn('x-account-meta-test-account-meta1', resp)308 self.assertIn('x-account-meta-test-account-meta2', resp)309 self.assertEqual(resp['x-account-meta-test-account-meta2'],310 metadata_2['test-account-meta2'])311 self.account_client.create_update_or_delete_account_metadata(...
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!!