How to use the scanapi.settings.settings 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_settings.py View on Github external
def test_should_clean_and_save_preferences(self):
            settings.save_click_preferences(
                **{
                    "spec_path": "path/spec-path",
                    "reporter": None,
                    "output_path": "path/output-path",
                    "template": None,
                    "config_path": "path/config-path",
                }
            )

            assert settings == {
                "spec_path": "path/spec-path",
                "output_path": "path/output-path",
                "template": None,
                "config_path": "path/config-path",
            }
github camilamaia / scanapi / tests / unit / test_settings.py View on Github external
def test_should_pass_config_path_as_none(
                self, mock_save_click_preferences, mock_save_config_file_preferences
            ):
                preferences = {"foo": "bar"}
                settings.save_preferences(**preferences)
                mock_save_config_file_preferences.assert_called_with(None)
                mock_save_click_preferences.assert_called_with(**preferences)
github camilamaia / scanapi / tests / unit / test_settings.py View on Github external
def define_settings(self):
            settings["spec_path"] = "path/spec-path.yaml"
            settings["output_path"] = "path/output-path.yaml"
            settings["template"] = None
            settings["config_path"] = "path/config-path.yaml"
github camilamaia / scanapi / tests / unit / test_settings.py View on Github external
def test_should_raise_exception(self):
                    with pytest.raises(FileNotFoundError) as excinfo:
                        config_path = "invalid/my_config_file.yaml"
                        settings.save_config_file_preferences(config_path)

                    assert (
                        str(excinfo.value)
                        == "[Errno 2] No such file or directory: 'invalid/my_config_file.yaml'"
                    )
github camilamaia / scanapi / scanapi / scan.py View on Github external
def write_report(results):
    reporter = Reporter(settings["output_path"], settings["template"])
    reporter.write(results)
github camilamaia / scanapi / scanapi / main.py View on Github external
"""
    Automated Testing and Documentation for your REST API.
    SPEC_PATH argument is the API specification file path.
    """
    session.start()
    logging.basicConfig(level=log_level, format="%(message)s")
    logger = logging.getLogger(__name__)

    click_preferences = {
        "spec_path": spec_path,
        "output_path": output_path,
        "config_path": config_path,
        "template": template,
    }

    settings.save_preferences(**click_preferences)
    scan()
github camilamaia / scanapi / scanapi / utils.py View on Github external
def hide_sensitive_info(response):
    report_settings = settings.get("report", {})
    request = response.request
    request_settings = report_settings.get("hide-request", {})
    response_settings = report_settings.get("hide-response", {})

    _hide(request, request_settings)
    _hide(response, response_settings)
github camilamaia / scanapi / scanapi / reporter.py View on Github external
def _build_context(self, results):
        return {
            "now": datetime.datetime.now().replace(microsecond=0),
            "project_name": settings.get("project-name", ""),
            "results": results,
            "session": session,
        }