Best Python code snippet using localstack_python
test_app_api_handlers_on_first_request.py
Source:test_app_api_handlers_on_first_request.py
...16 )17 )18@pytest.mark.requires_fresh_app19class TestFreshAppDeleteTemplate(object):20 def test_delete_template(self, app: conftest.App, docker_container: conftest.DockerContainer):21 tmpl_id = 'd_tmpl'22 r = app.delete_template(tmpl_id)23 A.templates_delete_response(24 r=r,25 code=404,26 message=f'No template with tmpl_id={tmpl_id} found!',27 msg=(28 'When app is just started'29 ' and does not have any templates'30 ' it must not fall on attempt to delete a template\n'31 'It must return a message which looks like "No template with tmpl_id=<tmpl_id> found!"'32 )33 )34@pytest.mark.requires_fresh_app35class TestFreshAppUploadTemplate(object):36 def test_upload_template(self, app: conftest.App, docker_container: conftest.DockerContainer):37 tmpl_id = "u_template"38 r = app.upload_template('app_templates/template1.yaml', tmpl_id)39 A.templates_upload_response(40 r,41 f'Template successfully uploaded. tmpl_id={tmpl_id}',42 msg='Upload a template'43 )44 r = app.list_templates()45 A.templates_list_response(46 r, [tmpl_id], exact_match=True, msg='List of templates must have one item which is id of our new template'47 )48@pytest.mark.requires_fresh_app49class TestFreshAppInstallTemplate(object):50 def test_delete_template(self, app: conftest.App, docker_container: conftest.DockerContainer):51 tmpl_id = 'd_tmpl'52 r = app.install_template(tmpl_id)53 A.templates_delete_response(54 r=r,55 code=404,56 message=f'No template with tmpl_id={tmpl_id} found!',57 msg=(58 'When app is just started'59 ' and does not have any templates'60 ' it must not fall on attempt to install a template\n'61 'It must return a message which looks like "No template with tmpl_id=<tmpl_id> found!"'62 )...
run_all_by_order_starter.py
Source:run_all_by_order_starter.py
1"""2AUTHOR: Seamus3DATE: 2020/09/144DESCRIPTION:ææå®é¡ºåºè¿è¡case5"""67import os89from Starter.starter import Starter10from Utils.parse_error import get_error111213class ExampleGroupStarter(Starter):14 stdout = True15 reruns = 016 reruns_delay = 517 nodes = [18 # './TestCases/Example/test_case2.py::TestCase2::test_case2_1',19 # './TestCases/Example/test_case1.py::TestCase1'20 '../TestCases/Login/test_account_login.py',21 '../TestCases/TaskList/create_inspect_single_store.py',22 '../TestCases/CheckList/test_add_category.py::TestAddCategory::test_cancel_add_category',23 '../TestCases/CheckList/test_add_category.py::TestAddCategory::test_confirm_add_category',24 '../TestCases/CheckList/test_scoring_items.py::TestAddScoringItems::test_confirm_add_scoring_items',25 '../TestCases/CheckList/test_scoring_items.py::TestAddScoringItems::test_cancel_add_scoring_items',26 '../TestCases/CheckList/test_create_mark_template.py',27 '../TestCases/CheckList/test_create_points_template.py',28 '../TestCases/CheckList/test_edit_template.py::TestEditMarkist::test_edit_check_list_cancel',29 '../TestCases/CheckList/test_edit_template.py::TestEditMarkist::test_edit_check_list_confirm',30 '../TestCases/CheckList/test_point_switch_to_mark.py',31 '../TestCases/CheckList/test_mark_switch_to_point.py',32 '../TestCases/TaskList/create_inspect_multiple_stores.py',33 '../TestCases/TaskList/delete_task.py',34 '../TestCases/CheckList/test_delete_template.py::TestDeleteMarkist::test_delete_check_list_confirm',35 '../TestCases/CheckList/test_delete_template.py::TestDeleteMarkist::test_delete_check_list_cancel',3637 ]38 additions = ['--alluredir=../PytestReports/report', '--clean-alluredir']394041if __name__ == '__main__':42 exit_code = ExampleGroupStarter().start()43 print(get_error(exit_code))44 if exit_code in (0, 1):45 os.system('allure generate ../PytestReports/report/ -o ../PytestReports/html/ --clean')
...
test_crud_bp.py
Source:test_crud_bp.py
...7 assert (8 b'<form method="POST" enctype="multipart/form-data" id="uploadImgForm">'9 in res.data10 )11def test_delete_template(db_template, logged_in_client):12 template_id = db_template.id13 res = logged_in_client.get(f"/delete/{template_id}", follow_redirects=True)14 assert res.status_code == 20015 assert res.request.path == "/view"16 assert b"template deleted!" in res.data17def test_edit_template(client, db_template):18 res = client.get(f"/edit/{db_template.id}")19 assert res.status_code == 20020 # template rendered with script tag to load template json into canvas21 # assertion to check if template loaded correctly22 assert (23 b'name\\": \\"test template\\", \\"public\\": true, \\'24 b'"questions\\": [{\\"question_value\\": \\"question test\\", '25 b'\\"multiple_choice\\": false, \\"answers\\": [{\\"coordinates\\": '...
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!!