How to use the scanapi.session.session 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 / scanapi / tree / testing_node.py View on Github external
def _process_result(self, status):
        if status == TestStatus.ERROR:
            session.increment_errors()
            return

        if status == TestStatus.FAILED:
            session.increment_failures()
            return

        if status == TestStatus.PASSED:
            session.increment_successes()
github camilamaia / scanapi / scanapi / tree / testing_node.py View on Github external
def _process_result(self, status):
        if status == TestStatus.ERROR:
            session.increment_errors()
            return

        if status == TestStatus.FAILED:
            session.increment_failures()
            return

        if status == TestStatus.PASSED:
            session.increment_successes()
github camilamaia / scanapi / scanapi / scan.py View on Github external
MissingMandatoryKeyError,
        KeyError,
        InvalidPythonCodeError,
    ) as e:
        error_message = "Error loading API spec."
        error_message = "{} {}".format(error_message, str(e))
        logger.error(error_message)
        raise SystemExit(ExitCode.USAGE_ERROR)

    try:
        write_report(results)
    except (BadConfigurationError, InvalidPythonCodeError) as e:
        logger.error(e)
        raise SystemExit(ExitCode.USAGE_ERROR)

    session.exit()
github camilamaia / scanapi / scanapi / main.py View on Github external
def main(spec_path, output_path, config_path, template, log_level):
    """
    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 / 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,
        }