def _handle_run_report(report_name: str, overrides_dict: Dict[str, Any], issues: List[str]) -> Tuple[str, int, Dict[str, str]]: # Find and cleanse the title of the report report_title = validate_title(request.values.get("report_title"), issues) # Get mailto email address mailto = validate_mailto(request.values.get("mailto"), issues) # Find whether to generate PDF output generate_pdf_output = validate_generate_pdf_output( request.values.get("generatepdf"), issues) hide_code = request.values.get("hide_code") == "on" if issues: return jsonify({"status": "Failed", "content": ("\n".join(issues))}) report_name = convert_report_name_url_to_path(report_name) job_id = run_report(report_name, report_title, mailto, overrides_dict, generate_pdf_output=generate_pdf_output, hide_code=hide_code) return ( jsonify({"id": job_id}), 202, # HTTP Accepted code { "Location": url_for("pending_results_bp.task_status", report_name=report_name, job_id=job_id) }, )
def test_validate_mailto(test_name, mailto, expected_issues, expected_mailto): issues = [] actual_mailto = web.validate_mailto(mailto, issues) assert issues == expected_issues assert actual_mailto == expected_mailto