mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-05-07 22:40:49 +08:00
* fix: use tomlkit instead of toml & add --cli * fix: remove cli option, poetry groups ignored by pip * fix: redirect unittest patch * adding --cli to the dev install --------- Co-authored-by: hjoaquim <henriquecjoaquim@gmail.com>
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
"""Test the CLI module."""
|
|
|
|
from unittest.mock import patch
|
|
|
|
from openbb_cli.cli import main
|
|
|
|
|
|
@patch("openbb_cli.config.setup.bootstrap")
|
|
@patch("openbb_cli.controllers.cli_controller.launch")
|
|
@patch("sys.argv", ["openbb", "--dev", "--debug"])
|
|
def test_main_with_dev_and_debug(mock_launch, mock_bootstrap):
|
|
"""Test the main function with dev and debug flags."""
|
|
main()
|
|
mock_bootstrap.assert_called_once()
|
|
mock_launch.assert_called_once_with(True, True)
|
|
|
|
|
|
@patch("openbb_cli.config.setup.bootstrap")
|
|
@patch("openbb_cli.controllers.cli_controller.launch")
|
|
@patch("sys.argv", ["openbb"])
|
|
def test_main_without_arguments(mock_launch, mock_bootstrap):
|
|
"""Test the main function without arguments."""
|
|
main()
|
|
mock_bootstrap.assert_called_once()
|
|
mock_launch.assert_called_once_with(False, False)
|
|
|
|
|
|
@patch("openbb_cli.config.setup.bootstrap")
|
|
@patch("openbb_cli.controllers.cli_controller.launch")
|
|
@patch("sys.argv", ["openbb", "--dev"])
|
|
def test_main_with_dev_only(mock_launch, mock_bootstrap):
|
|
"""Test the main function with dev flag only."""
|
|
main()
|
|
mock_bootstrap.assert_called_once()
|
|
mock_launch.assert_called_once_with(True, False)
|
|
|
|
|
|
@patch("openbb_cli.config.setup.bootstrap")
|
|
@patch("openbb_cli.controllers.cli_controller.launch")
|
|
@patch("sys.argv", ["openbb", "--debug"])
|
|
def test_main_with_debug_only(mock_launch, mock_bootstrap):
|
|
"""Test the main function with debug flag only."""
|
|
main()
|
|
mock_bootstrap.assert_called_once()
|
|
mock_launch.assert_called_once_with(False, True)
|