Best Python code snippet using tempest_python
test_account_services.py
Source:test_account_services.py
...73 # Check only the format of common headers with custom matcher74 self.assertThat(resp, custom_matchers.AreAllWellFormatted())75 self.assertEqual(len(container_list), 0)76 @test.idempotent_id('1c7efa35-e8a2-4b0b-b5ff-862c7fd83704')77 def test_list_containers_with_format_json(self):78 # list containers setting format parameter to 'json'79 params = {'format': 'json'}80 resp, container_list = self.account_client.list_account_containers(81 params=params)82 self.assertHeaders(resp, 'Account', 'GET')83 self.assertIsNotNone(container_list)84 self.assertTrue([c['name'] for c in container_list])85 self.assertTrue([c['count'] for c in container_list])86 self.assertTrue([c['bytes'] for c in container_list])87 @test.idempotent_id('4477b609-1ca6-4d4b-b25d-ad3f01086089')88 def test_list_containers_with_format_xml(self):89 # list containers setting format parameter to 'xml'90 params = {'format': 'xml'}91 resp, container_list = self.account_client.list_account_containers(...
_test_foo.py
Source:_test_foo.py
1from pytest import mark, skip, fixture2from keywords import vm_helper3from utils.tis_log import LOG4from utils import exceptions5_skip = True6# @mark.skipif(_skip, reason='test skip if')7# @mark.usefixtures('check_alarms')8@mark.parametrize(('param1', 'param2', 'param3'), [9 ('val1', 1, True),10 ('val2', 2, False),11 ('val2', 2, True),12])13def test_dummy1(param1, param2, param3):14 LOG.tc_step("test dummy 1 step~~ \nparam1: {}, param2:{}".format(15 param1, param2))16 res = vm_helper.get_all_vms()17 if not param3:18 skip("param3 is : {}".format(param3))19 LOG.info("All VMs: {}".format(res))20 if param2 == 1:21 raise Exception("test failure with exception")22 assert 0, 'dummy test failed ~~~~~~'23@mark.usefixtures('check_alarms')24def test_dummy2():25 LOG.tc_step("test dummy 2 step~~")26 pass27def test_fooo1():28 assert False, '1\n2\3\n4\n5\n6\n7\n8\n9\n10\n11'29def test_fooo2(foo_setup_fail):30 pass31def test_fooo3(foo_teardown_fail):32 #33 #34 error = """35test: tempest.api.compute.servers.test_create_server.ServersTestJSON.test_host_name_is_same_as_server_name[id-ac1ad47f-984b-4441-9274-c9079b7a0666]36test: tempest.api.compute.servers.test_create_server.ServersTestJSON.test_verify_created_server_vcpus[id-cbc0f52f-05aa-492b-bdc1-84b575ca294b]37test: tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_host_name_is_same_as_server_name[id-ac1ad47f-984b-4441-9274-c9079b7a0666]38test: tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_verify_created_server_vcpus[id-cbc0f52f-05aa-492b-bdc1-84b575ca294b]39test: tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_reboot_server_hard[id-2cb1baf6-ac8d-4429-bf0d-ba8a0ba53e32,smoke]40test: tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_rebuild_server[id-aaa6cdf3-55a7-461a-add9-1c8596b9a07c]41test: tempest.api.compute.volumes.test_attach_volume.AttachVolumeTestJSON.test_attach_detach_volume[id-52e9045a-e90d-4c0d-9087-79d657faffff]42test: tempest.api.object_storage.test_account_services.AccountTest.test_list_containers[id-3499406a-ae53-4f8c-b43a-133d4dc6fe3f,smoke]43test: tempest.api.object_storage.test_account_services.AccountTest.test_list_containers_with_end_marker[id-5ca164e4-7bde-43fa-bafb-913b53b9e786]44test: tempest.api.object_storage.test_account_services.AccountTest.test_list_containers_with_format_json[id-1c7efa35-e8a2-4b0b-b5ff-862c7fd83704]45test: tempest.api.object_storage.test_account_services.AccountTest.test_list_containers_with_limit[id-5cfa4ab2-4373-48dd-a41f-a532b12b08b2]46test: tempest.api.object_storage.test_account_services.AccountTest.test_list_containers_with_limit_and_end_marker[id-888a3f0e-7214-4806-8e50-5e0c9a69bb5e]47test: tempest.api.object_storage.test_account_services.AccountTest.test_list_containers_with_limit_and_marker[id-f7064ae8-dbcc-48da-b594-82feef6ea5af]48test: tempest.api.object_storage.test_account_services.AccountTest.test_list_containers_with_limit_and_marker_and_end_marker[id-8cf98d9c-e3a0-4e44-971b-c87656fdddbd]49test: tempest.api.object_storage.test_account_services.AccountTest.test_list_containers_with_marker[id-638f876d-6a43-482a-bbb3-0840bca101c6]50test: tempest.api.object_storage.test_account_services.AccountTest.test_list_containers_with_marker_and_end_marker[id-ac8502c2-d4e4-4f68-85a6-40befea2ef5e]51test: tempest.api.object_storage.test_container_acl.ObjectTestACLs.test_read_object_with_rights[id-a3270f3f-7640-4944-8448-c7ea783ea5b6]52test: tempest.api.object_storage.test_container_acl.ObjectTestACLs.test_write_object_with_rights[id-aa58bfa5-40d9-4bc3-82b4-d07f4a9e392a]53"""54 raise exceptions.RefStackError(error)55def test_fooo4(foo_teardown_fail):56 assert 0, "test fun fail"57@fixture(scope='function')58def foo_setup_fail():59 raise ValueError("setup fail")60@fixture(scope='function')61def foo_teardown_fail(request):62 def teardown():63 raise IndexError('teardown fail')...
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!!