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 / tests / unit / test_session.py View on Github external
def test_exit_with_proper_error(self, failures, errors, error_code):
            session = Session()
            session.failures = failures
            session.errors = errors
            with pytest.raises(SystemExit) as excinfo:
                session.exit()

            assert excinfo.type == SystemExit
            assert excinfo.value.code == error_code
github camilamaia / scanapi / tests / unit / test_session.py View on Github external
def test_init_successes_and_failures(self):
            session = Session()

            assert session.successes == 0
            assert session.failures == 0
github camilamaia / scanapi / tests / unit / test_session.py View on Github external
def test_increment(self):
            session = Session()
            times = randrange(1, 10)

            for _ in range(times):
                session.increment_failures()

            assert session.failures == times
github camilamaia / scanapi / tests / unit / test_session.py View on Github external
def test_increment(self):
            session = Session()
            times = randrange(1, 10)

            for _ in range(times):
                session.increment_errors()

            assert session.errors == times
github camilamaia / scanapi / tests / unit / test_session.py View on Github external
def test_return_time(self, freezer):
            session = Session()
            session.start()

            freezer.move_to("2020-06-15 18:56:38")

            assert str(session.elapsed_time()) == "0:01:41"
github camilamaia / scanapi / tests / unit / test_session.py View on Github external
def test_increment(self):
            session = Session()
            times = randrange(1, 10)

            for _ in range(times):
                session.increment_successes()

            assert session.successes == times
github camilamaia / scanapi / tests / unit / test_session.py View on Github external
def test_failed_when_there_is_failure(self, failures, errors, expected):
            session = Session()
            session.failures = failures
            session.errors = errors
            assert session.succeed == expected
github camilamaia / scanapi / tests / unit / test_session.py View on Github external
def test_init_started_at(self):
            session = Session()
            session.start()

            assert str(session.started_at) == "2020-06-15 18:54:57"
github camilamaia / scanapi / scanapi / session.py View on Github external
sys.exit(self.exit_code)

    def increment_successes(self):
        self.successes += 1

    def increment_failures(self):
        self.failures += 1

    def increment_errors(self):
        self.errors += 1

    def elapsed_time(self):
        return datetime.now() - self.started_at


session = Session()