mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-30 05:52:23 +00:00
[Feature] Add Support For Python 3.14 (#7349)
* add support for Python 3.14 * escape % in argparse_translator in help strings * black * cli python version string * fix test param placeholder * fix integration_tests_testers * add 3.14 to ODP Desktop environment creation choices * partial lock update * update lock files * and the rest of the locks --------- Co-authored-by: deeleeramone <>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""Test the CLI controller."""
|
||||
|
||||
from unittest.mock import MagicMock, patch
|
||||
from unittest.mock import MagicMock, mock_open, patch
|
||||
|
||||
import pytest
|
||||
from openbb_cli.controllers.cli_controller import (
|
||||
@@ -61,19 +61,27 @@ def test_run_cli_quit_command(mock_print_goodbye, mock_switch):
|
||||
mock_print_goodbye.assert_called_once()
|
||||
|
||||
|
||||
@pytest.mark.skip("This test is not working as expected")
|
||||
def test_execute_openbb_routine_with_mocked_requests():
|
||||
@patch(
|
||||
"openbb_cli.controllers.cli_controller.parse_openbb_script",
|
||||
return_value=("mocked", ""),
|
||||
)
|
||||
@patch(
|
||||
"openbb_cli.controllers.cli_controller.CLIController.update_runtime_choices",
|
||||
)
|
||||
@patch("builtins.open", new_callable=mock_open, read_data="print('Hello World')")
|
||||
@patch("requests.get")
|
||||
def test_execute_openbb_routine_with_mocked_requests(
|
||||
mock_get, mock_file, mock_update, mock_parse
|
||||
):
|
||||
"""Test the call_exe function with mocked requests."""
|
||||
with patch("requests.get") as mock_get:
|
||||
response = MagicMock()
|
||||
response.status_code = 200
|
||||
response.json.return_value = {"script": "print('Hello World')"}
|
||||
mock_get.return_value = response
|
||||
# Here we need to call the correct function, assuming it's something like `call_exe` for URL-based scripts
|
||||
controller = CLIController()
|
||||
controller.call_exe(
|
||||
["--url", "https://my.openbb.co/u/test/routine/test.openbb"]
|
||||
)
|
||||
mock_get.assert_called_with(
|
||||
"https://my.openbb.co/u/test/routine/test.openbb?raw=true", timeout=10
|
||||
)
|
||||
response = MagicMock()
|
||||
response.status_code = 200
|
||||
response.json.return_value = {"script": "print('Hello World')"}
|
||||
mock_get.return_value = response
|
||||
controller = CLIController()
|
||||
controller.call_exe(
|
||||
["--url", "https://my.openbb.co/u/test/routine/test.openbb"]
|
||||
)
|
||||
mock_get.assert_called_with(
|
||||
"https://my.openbb.co/u/test/routine/test.openbb?raw=true", timeout=10
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user