Beispiel #1
0
    def call_fmp(self, _):
        """Process fmp command"""
        ret = fmp_controller.menu(self.ticker, self.start, self.interval)

        if ret is False:
            self.print_help()
        else:
            return True
Beispiel #2
0
def test_menu_with_queue(expected, mocker, queue):
    mocker.patch(
        target=
        ("gamestonk_terminal.stocks.fundamental_analysis.financial_modeling_prep.fmp_controller."
         "FinancialModelingPrepController.switch"),
        return_value=["quit"],
    )
    result_menu = fmp_controller.menu(
        ticker="TSLA",
        start="10/25/2021",
        interval="1440min",
        queue=queue,
    )

    assert result_menu == expected
Beispiel #3
0
def test_menu_without_queue_sys_exit(mock_input, mocker):
    # DISABLE AUTO-COMPLETION
    mocker.patch.object(
        target=fmp_controller.gtff,
        attribute="USE_PROMPT_TOOLKIT",
        new=False,
    )
    mocker.patch(
        target=
        "gamestonk_terminal.stocks.fundamental_analysis.financial_modeling_prep.fmp_controller.session",
        return_value=None,
    )

    # MOCK USER INPUT
    mocker.patch("builtins.input", return_value=mock_input)

    # MOCK SWITCH
    class SystemExitSideEffect:
        def __init__(self):
            self.first_call = True

        def __call__(self, *args, **kwargs):
            if self.first_call:
                self.first_call = False
                raise SystemExit()
            return ["quit"]

    mock_switch = mocker.Mock(side_effect=SystemExitSideEffect())
    mocker.patch(
        target=
        ("gamestonk_terminal.stocks.fundamental_analysis.financial_modeling_prep.fmp_controller."
         "FinancialModelingPrepController.switch"),
        new=mock_switch,
    )
    result_menu = fmp_controller.menu(ticker="TSLA",
                                      start="10/25/2021",
                                      interval="1440min",
                                      queue=None)

    assert result_menu == []
Beispiel #4
0
def test_menu_without_queue_completion(mocker):
    # DISABLE AUTO-COMPLETION
    mocker.patch.object(
        target=fmp_controller.gtff,
        attribute="USE_PROMPT_TOOLKIT",
        new=True,
    )
    mocker.patch(
        target=
        "gamestonk_terminal.stocks.fundamental_analysis.financial_modeling_prep.fmp_controller.session",
    )
    mocker.patch(
        target=
        "gamestonk_terminal.stocks.fundamental_analysis.financial_modeling_prep.fmp_controller.session.prompt",
        return_value="quit",
    )
    result_menu = fmp_controller.menu(ticker="TSLA",
                                      start="10/25/2021",
                                      interval="1440min",
                                      queue=None)

    assert result_menu == []
 def call_fmp(self, _):
     """Process fmp command."""
     self.queue = fmp_controller.menu(self.ticker, self.start,
                                      self.interval, self.queue)