def test_menu_without_queue_completion(mocker): path_controller = "gamestonk_terminal.jupyter.jupyter_controller" # ENABLE AUTO-COMPLETION : HELPER_FUNCS.MENU mocker.patch( target="gamestonk_terminal.feature_flags.USE_PROMPT_TOOLKIT", new=True, ) mocker.patch(target="gamestonk_terminal.parent_classes.session", ) mocker.patch( target="gamestonk_terminal.parent_classes.session.prompt", return_value="quit", ) # DISABLE AUTO-COMPLETION : CONTROLLER.COMPLETER mocker.patch.object( target=jupyter_controller.gtff, attribute="USE_PROMPT_TOOLKIT", new=True, ) mocker.patch(target=f"{path_controller}.session", ) mocker.patch( target=f"{path_controller}.session.prompt", return_value="quit", ) result_menu = jupyter_controller.JupyterController(queue=None).menu() assert result_menu == []
def test_call_cls(mocker): mocker.patch("os.system") controller = jupyter_controller.JupyterController(queue=None) controller.call_cls([]) assert controller.queue == [] os.system.assert_called_once_with("cls||clear")
def test_menu_with_queue(expected, mocker, queue): path_controller = "gamestonk_terminal.jupyter.jupyter_controller" # MOCK SWITCH mocker.patch( target=f"{path_controller}.JupyterController.switch", return_value=["quit"], ) result_menu = jupyter_controller.JupyterController(queue=queue).menu() assert result_menu == expected
def test_switch(an_input, expected_queue): controller = jupyter_controller.JupyterController(queue=None) queue = controller.switch(an_input=an_input) assert queue == expected_queue
def test_print_help(): controller = jupyter_controller.JupyterController(queue=None) controller.print_help()
def test_call_func_expect_queue(expected_queue, func, queue): controller = jupyter_controller.JupyterController(queue=queue) result = getattr(controller, func)([]) assert result is None assert controller.queue == expected_queue