def test_should_write_to_default_output( self, mocker, mocked__render, mocked__open, mocked__session, context, ): mocked__render.return_value = "ScanAPI Report" reporter = Reporter() reporter.write(fake_results) mocked__render.assert_called_once_with("report.html", context, False) mocked__open.assert_called_once_with("scanapi-report.html", "w", newline="\n") mocked__open().write.assert_called_once_with("ScanAPI Report")
def test_should_write_to_custom_output( self, mocker, mocked__render, mocked__open, mocked__session, context, ): mocked__render.return_value = "ScanAPI Report" reporter = Reporter("./custom/report-output.html", "html") reporter.write(fake_results) mocked__render.assert_called_once_with("html", context, True) mocked__open.assert_called_once_with("./custom/report-output.html", "w", newline="\n") mocked__open().write.assert_called_once_with("ScanAPI Report")
def test_should_handle_custom_templates( self, mocker, mocked__render, mocked__open, mocked__session, context, ): mocked__render.return_value = "ScanAPI Report" reporter = Reporter(template="my-template.html") reporter.write(fake_results) mocked__render.assert_called_once_with("my-template.html", context, True) mocked__open.assert_called_once_with("scanapi-report.html", "w", newline="\n") mocked__open().write.assert_called_once_with("ScanAPI Report")
def write_report(results): reporter = Reporter(settings["output_path"], settings["template"]) reporter.write(results)
def write_report(results): """ Constructs a Reporter object and calls the write method of Reporter to push the results to a file. """ reporter = Reporter(settings["output_path"], settings["template"]) reporter.write(results)