def test_menu_without_queue_completion(mocker):
    path_controller = "gamestonk_terminal.jupyter.dashboards.dashboards_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=dashboards_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 = dashboards_controller.DashboardsController(queue=None).menu()

    assert result_menu == []
def test_call_cls(mocker):
    mocker.patch("os.system")

    controller = dashboards_controller.DashboardsController(queue=None)
    controller.call_cls([])

    assert controller.queue == []
    os.system.assert_called_once_with("cls||clear")
Ejemplo n.º 3
0
def test_menu_with_queue(expected, mocker, queue):
    path_controller = "gamestonk_terminal.jupyter.dashboards.dashboards_controller"

    # MOCK SWITCH
    mocker.patch(
        target=f"{path_controller}.DashboardsController.switch",
        return_value=["quit"],
    )
    result_menu = dashboards_controller.DashboardsController(queue=queue).menu()

    assert result_menu == expected
def test_switch(an_input, expected_queue):
    controller = dashboards_controller.DashboardsController(queue=None)
    queue = controller.switch(an_input=an_input)

    assert queue == expected_queue
def test_print_help():
    controller = dashboards_controller.DashboardsController(queue=None)
    controller.print_help()
def test_call_func_expect_queue(expected_queue, func, queue):
    controller = dashboards_controller.DashboardsController(queue=queue)
    result = getattr(controller, func)([])

    assert result is None
    assert controller.queue == expected_queue