How to use the scanapi.test_status.TestStatus 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 / tree / testing_node.py View on Github external
def run(self):
        try:
            passed, failure = self.request.endpoint.vars.evaluate_assertion(
                self.assertion
            )

            status = TestStatus.PASSED if passed else TestStatus.FAILED
            error = None
        except Exception as e:
            status = TestStatus.ERROR
            failure = None
            error = str(e)

        self._process_result(status)
        self._log_result(status, failure)

        return {
            "name": self.full_name,
            "status": status,
            "failure": failure,
            "error": error,
        }
github camilamaia / scanapi / scanapi / tree / testing_node.py View on Github external
def run(self):
        try:
            passed, failure = self.request.endpoint.vars.evaluate_assertion(
                self.assertion
            )

            status = TestStatus.PASSED if passed else TestStatus.FAILED
            error = None
        except Exception as e:
            status = TestStatus.ERROR
            failure = None
            error = str(e)

        self._process_result(status)
        self._log_result(status, failure)

        return {
            "name": self.full_name,
            "status": status,
            "failure": failure,
            "error": error,
        }
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 / request_node.py View on Github external
allow_redirects=False,
        )

        self.endpoint.vars.update(
            self.spec.get(VARS_KEY, {}), extras={"response": response}, preevaluate=True
        )

        tests_results = self._run_tests()
        hide_sensitive_info(response)

        return {
            "response": response,
            "tests_results": tests_results,
            "no_failure": all(
                [
                    test_result["status"] == TestStatus.PASSED
                    for test_result in tests_results
                ]