def _get_test_definition(name, ref_type): """ get expected api or suite. @params: name: api or suite name ref_type: "api" or "suite" @return expected api info if found, otherwise raise ApiNotFound exception """ block = TestcaseLoader.overall_def_dict.get(ref_type, {}).get(name) if not block: err_msg = "{} not found!".format(name) if ref_type == "api": raise exception.ApiNotFound(err_msg) else: # ref_type == "suite": raise exception.SuiteNotFound(err_msg) return block
def get_test_definition(name, ref_type): """ get expected api or suite. @params: name: api or suite name ref_type: "api" or "suite" @return expected api info if found, otherwise raise ApiNotFound exception """ if not test_def_overall_dict.get("loaded", False): load_test_dependencies() test_info = test_def_overall_dict.get(ref_type, {}).get(name) if not test_info: err_msg = "{} {} not found!".format(ref_type, name) if ref_type == "api": raise exception.ApiNotFound(err_msg) elif ref_type == "suite": raise exception.SuiteNotFound(err_msg) else: raise exception.ParamsError("ref_type can only be api or suite!") return test_info