Best Python code snippet using rester_python
test_output.py
Source:test_output.py
...5import os6from test import Common7@unittest.skipIf(Common.GENERATING_MODE, 'Skipping test_output in generating mode')8class test_output(Common, unittest.TestCase):9 def run_test_case(self, input_file, args=[], expected_output_files=None):10 args = list(args)11 args.insert(0, os.path.join(self.TEST_DIR, 'test_output', input_file))12 result = self.run_pdf2htmlEX(args)13 if expected_output_files:14 self.assertItemsEqual(result['output_files'], expected_output_files)15 def test_generate_single_html_default_name_single_page_pdf(self):16 self.run_test_case('1-page.pdf', expected_output_files = ['1-page.html'])17 def test_generate_single_html_default_name_multiple_page_pdf(self):18 self.run_test_case('2-pages.pdf', expected_output_files = ['2-pages.html'])19 def test_generate_single_html_specify_name_single_page_pdf(self):20 self.run_test_case('1-page.pdf', ['foo.html'], expected_output_files = ['foo.html'])21 def test_generate_single_html_specify_name_multiple_page_pdf(self):22 self.run_test_case('2-pages.pdf', ['foo.html'], expected_output_files = ['foo.html'])23 def test_generate_split_pages_default_name_single_page(self):24 self.run_test_case('1-page.pdf', ['--split-pages', 1], expected_output_files = ['1-page.html', '1-page1.page'])25 def test_generate_split_pages_default_name_multiple_pages(self):26 self.run_test_case('3-pages.pdf', ['--split-pages', 1], expected_output_files = ['3-pages.html', '3-pages1.page', '3-pages2.page', '3-pages3.page'])27 def test_generate_split_pages_specify_name_single_page(self):28 self.run_test_case('1-page.pdf', ['--split-pages', 1, '--page-filename', 'foo.xyz'], expected_output_files = ['1-page.html', 'foo1.xyz'])29 def test_generate_split_pages_specify_name_multiple_pages(self):30 self.run_test_case('3-pages.pdf', ['--split-pages', 1, '--page-filename', 'foo.xyz'], expected_output_files = ['3-pages.html', 'foo1.xyz', 'foo2.xyz', 'foo3.xyz'])31 def test_generate_split_pages_specify_name_formatter_multiple_pages(self):32 self.run_test_case('3-pages.pdf', ['--split-pages', 1, '--page-filename', 'fo%do.xyz'], expected_output_files = ['3-pages.html', 'fo1o.xyz', 'fo2o.xyz', 'fo3o.xyz'])33 def test_generate_split_pages_specify_name_formatter_with_padded_zeros_multiple_pages(self):34 self.run_test_case('3-pages.pdf', ['--split-pages', 1, '--page-filename', 'fo%03do.xyz'], expected_output_files = ['3-pages.html', 'fo001o.xyz', 'fo002o.xyz', 'fo003o.xyz'])35 def test_generate_split_pages_specify_name_only_first_formatter_gets_taken(self):36 self.run_test_case('3-pages.pdf', ['--split-pages', 1, '--page-filename', 'f%do%do.xyz'], expected_output_files = ['3-pages.html', 'f1o%do.xyz', 'f2o%do.xyz', 'f3o%do.xyz'])37 def test_generate_split_pages_specify_name_only_percent_d_is_used_percent_s(self):38 self.run_test_case('3-pages.pdf', ['--split-pages', 1, '--page-filename', 'f%soo.xyz'], expected_output_files = ['3-pages.html', 'f%soo1.xyz', 'f%soo2.xyz', 'f%soo3.xyz'])39 def test_generate_split_pages_specify_name_only_percent_d_is_used_percent_p(self):40 self.run_test_case('3-pages.pdf', ['--split-pages', 1, '--page-filename', 'f%poo.xyz'], expected_output_files = ['3-pages.html', 'f%poo1.xyz', 'f%poo2.xyz', 'f%poo3.xyz'])41 def test_generate_split_pages_specify_name_only_percent_d_is_used_percent_n(self):42 self.run_test_case('3-pages.pdf', ['--split-pages', 1, '--page-filename', 'f%noo.xyz'], expected_output_files = ['3-pages.html', 'f%noo1.xyz', 'f%noo2.xyz', 'f%noo3.xyz'])43 def test_generate_split_pages_specify_name_only_percent_d_is_used_percent_percent(self):44 self.run_test_case('3-pages.pdf', ['--split-pages', 1, '--page-filename', 'f%%oo.xyz'], expected_output_files = ['3-pages.html', 'f%%oo1.xyz', 'f%%oo2.xyz', 'f%%oo3.xyz'])45 def test_generate_split_pages_specify_name_only_percent_d_is_used_percent_percent_with_actual_placeholder(self):46 self.run_test_case('3-pages.pdf', ['--split-pages', 1, '--page-filename', 'f%%o%do.xyz'], expected_output_files = ['3-pages.html', 'f%%o1o.xyz', 'f%%o2o.xyz', 'f%%o3o.xyz'])47 def test_generate_split_pages_specify_name_only_percent_d_is_used_percent_percent_with_actual_placeholder(self):48 self.run_test_case('3-pages.pdf', ['--split-pages', 1, '--page-filename', 'fo%do%%.xyz'], expected_output_files = ['3-pages.html', 'fo1o%%.xyz', 'fo2o%%.xyz', 'fo3o%%.xyz'])49 def test_generate_split_pages_specify_name_only_formatter_starts_part_way_through_invalid_formatter(self):50 self.run_test_case('3-pages.pdf', ['--split-pages', 1, '--page-filename', 'f%02%doo.xyz'], expected_output_files = ['3-pages.html', 'f%021oo.xyz', 'f%022oo.xyz', 'f%023oo.xyz'])51 def test_generate_split_pages_specify_output_filename_no_formatter_no_extension(self):52 self.run_test_case('1-page.pdf', ['--split-pages', 1, '--page-filename', 'foo'], expected_output_files = ['1-page.html', 'foo1'])53 def test_generate_single_html_name_specified_format_characters_percent_d(self):54 self.run_test_case('2-pages.pdf', ['foo%d.html'], expected_output_files = ['foo%d.html'])55 def test_generate_single_html_name_specified_format_characters_percent_p(self):56 self.run_test_case('2-pages.pdf', ['foo%p.html'], expected_output_files = ['foo%p.html'])57 def test_generate_single_html_name_specified_format_characters_percent_n(self):58 self.run_test_case('2-pages.pdf', ['foo%n.html'], expected_output_files = ['foo%n.html'])59 def test_generate_single_html_name_specified_format_characters_percent_percent(self):60 self.run_test_case('2-pages.pdf', ['foo%%.html'], expected_output_files = ['foo%%.html'])61 def test_issue501(self):...
azure_bake_and_RB_deploy_lb.py
Source:azure_bake_and_RB_deploy_lb.py
...15 def scenario(self):16 return citest.base.TestRunner.global_runner().get_shared_data(17 AzureTestScenario)18 def test_a_create_app(self):19 self.run_test_case(self.scenario.create_app())20 def test_b_create_loadbalancer(self):21 self.run_test_case(self.scenario.create_load_balancer())22 def test_c1_create_bake_and_deploy_pipeline(self):23 self.run_test_case(self.scenario.create_bake_and_deploy_pipeline(strategy='redblack'))24 def test_c2_create_disable_and_destroy_pipeline(self):25 self.run_test_case(self.scenario.create_disable_and_destroy_pipeline())26 def test_d_trigger_bake_and_deploy_pipeline(self):27 self.run_test_case(self.scenario.trigger_bake_and_deploy_pipeline(sg_id='v000'))28 self.run_test_case(self.scenario.trigger_bake_and_deploy_pipeline(sg_id='v001'))29 self.run_test_case(self.scenario.trigger_bake_and_RB_deploy_pipeline())30 def test_w_trigger_disable_and_destroy_pipeline(self):31 self.run_test_case(self.scenario.trigger_disable_and_destroy(sg_id='v002'))32 self.run_test_case(self.scenario.trigger_disable_and_destroy(sg_id='v001'))33 def test_x1_delete_bake_and_deploy_pipeline(self):34 self.run_test_case(self.scenario.delete_pipeline(35 self.scenario.bake_pipeline_id36 ))37 def test_x2_delete_disable_and_destroy_pipeline(self):38 self.run_test_case(self.scenario.delete_pipeline(39 self.scenario.destroy_pipeline_id40 ))41 def test_y_delete_load_balancer(self):42 self.run_test_case(self.scenario.delete_load_balancer(),43 max_retries=1)44 def test_z_delete_app(self):45 self.run_test_case(self.scenario.delete_app(),46 retry_interval_secs=8, max_retries=8) 47def main():48 """Implements the main method running this smoke test."""49 with open('./azure_config.json', 'r', encoding='utf-8') as f:50 defaults = json.load(f)51 f.close()52 defaults['TEST_APP'] += "p0rblb" + AzureTestScenario.DEFAULT_TEST_ID53 return citest.base.TestRunner.main(54 parser_inits=[AzureTestScenario.initArgumentParser],55 default_binding_overrides=defaults,56 test_case_list=[AzureTest])57if __name__ == '__main__':...
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!!