How to use the scanapi.reporter.Reporter function in scanapi

To help you get started, we’ve selected a few scanapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github camilamaia / scanapi / tests / unit / test_reporter.py View on Github external
def test_init_output_path_and_template(self):
                reporter = Reporter(output_path="my-report.html")

                assert reporter.output_path == "my-report.html"
                assert reporter.template is None
github camilamaia / scanapi / tests / unit / test_reporter.py View on Github external
def test_init_output_path_and_template(self):
                reporter = Reporter(template="my_template.jinja")

                assert reporter.output_path == "scanapi-report.html"
                assert reporter.template == "my_template.jinja"
github camilamaia / scanapi / tests / unit / test_reporter.py View on Github external
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")
github camilamaia / scanapi / tests / unit / test_reporter.py View on Github external
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("html.jinja", context, False)
            mocked__open.assert_called_once_with(
                "scanapi-report.html", "w", newline="\n"
            )
            mocked__open().write.assert_called_once_with("ScanAPI Report")
github camilamaia / scanapi / tests / unit / test_reporter.py View on Github external
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")
github camilamaia / scanapi / tests / unit / test_reporter.py View on Github external
def test_init_output_path_and_template(self):
                reporter = Reporter()

                assert reporter.output_path == "scanapi-report.html"
                assert reporter.template is None