def test_bad_file(): """ Fail bad file """ with pytest.raises(OSError) as e: res = agg(CURRENT_DIR + "/bad/path.yml", argparse_obj_1) assert e.typename == 'OSError'
def test_two_args_str(): """ option: argv3, argv4 return get_one: scenario_2 """ res = agg(CURRENT_DIR + "/yaml/scenarios_examples.yml", argparse_obj_4) assert res.get_one() == "scenario_2"
def test_all_args(): """ option: "all" return get_one: scenario_1 """ res = agg(CURRENT_DIR + "/yaml/scenarios_examples_args.yml", argparse_obj_1) assert res.get_one() == "scenario_1"
def test_all_int(): """ option: "all" return get_one: 1 """ res = agg(CURRENT_DIR + "/yaml/scenarios_examples_digit.yml", argparse_obj_1) assert res.get_one() == 1
def test_args_args(): """ option: [argv3, argv4, argv6, argv7] return get_one: scenario_4 """ res = agg(CURRENT_DIR + "/yaml/scenarios_examples_args.yml", argparse_obj_3) assert res.get_one() == "scenario_4"
def test_args_int(): """ option: argv3, argv4, argv6, argv7 return get_one: 4 """ res = agg(CURRENT_DIR + "/yaml/scenarios_examples_digit.yml", argparse_obj_3) assert res.get_one() == 4
def test_args_args(): """ option: argv1, argv2, argv3, argv4 return get_one: scenario_3 """ res = agg(CURRENT_DIR + "/yaml/scenarios_examples_args.yml", argparse_obj_2) assert res.get_one() == "scenario_3"
def test_args_list(): """ options: - argv3 - argv4 - argv6 - argv7 return get_one: scenario_4 """ res = agg(CURRENT_DIR + "/yaml/scenarios_examples_list.yml", argparse_obj_3) assert res.get_one() == "scenario_4"
def test_all_list(): """ option: - argv1 - argv2 - argv3 - argv4 - argv5 - argv6 - argv7 return get_one: "scenario_1" """ res = agg(CURRENT_DIR + "/yaml/scenarios_examples_list.yml", argparse_obj_1) assert res.get_one() == "scenario_1"
def main(): configuration = parsarg() agG = agg("scenarios.yml", configuration) class_list_extract = [ Extract_content_file, Extract_content_directory_recursive, Extract_content_port ] class_list_generator = [ IT_generator_content, IT_generator_content, IT_generator_port ] scenario = agG.get_one() if type(scenario) is dict: return 0 content = class_list_extract[scenario](configuration) content_data = content.get_content() generator = class_list_generator[scenario](content_data, configuration) generator.generate()
def test_all_str(): """ option: "all" """ res = agg(CURRENT_DIR + "/yaml/scenarios_examples.yml", argparse_obj_1) assert res.get_one() == 'scenario_1'