Files
OpenBB/tests/test_terminal.py
Chavithra d135aac9c8 Updating tests : stocks/due_diligence (#1005)
* Updating tests : stocks/due_diligence + terminal

* Updating tests : doc

* Updating tests : conftest

* Update tests : pre-commit

* Updating tests : cassette + txt
2021-12-01 23:20:04 +00:00

34 lines
1.0 KiB
Python

import pytest
import terminal
@pytest.mark.block_network
@pytest.mark.record_stdout
def test_terminal_quick_exit(mocker, monkeypatch):
monkeypatch.setattr(terminal.gtff, "ENABLE_QUICK_EXIT", True)
monkeypatch.setattr(terminal.gtff, "USE_ION", True)
monkeypatch.setattr(terminal.gtff, "USE_PROMPT_TOOLKIT", True)
mocker.patch("sys.stdin")
terminal.terminal()
@pytest.mark.block_network
@pytest.mark.record_stdout
def test_terminal_quit(mocker, monkeypatch):
monkeypatch.setattr(terminal.gtff, "ENABLE_QUICK_EXIT", False)
monkeypatch.setattr(terminal.gtff, "USE_ION", True)
monkeypatch.setattr(terminal.gtff, "USE_PROMPT_TOOLKIT", True)
mocker.patch("sys.stdin")
mocker.patch("builtins.input", return_value="quit")
mocker.patch("terminal.session")
mocker.patch("terminal.session.prompt", return_value="quit")
mocker.patch("terminal.print_goodbye")
spy_print_goodbye = mocker.spy(terminal, "print_goodbye")
terminal.terminal()
spy_print_goodbye.assert_called_once()