Files
OpenBB/tests/openbb_terminal/test_settings_controller.py
Sam Kerr 497324d75f Preferred data source for a given command and help docs for any command (#1928)
* Add a feature flag loaded from . env for preferred data source

* Update the load command to use the preferred source

* Add a test

* Black syntax checker updates

* Update test syntax

* Update load command documentation

* Add a variable to read a sources file from

* Add a default sources.json file

* Add a helper function to read the source file and get the most relevant value

* Add some comments

* Remove older preferred data source file setting

* Add a default source file for data and use it if no user preference specifies a specific file

* Remove duplicate source file and old settings values

* Update the test file

* Update documentation string

* Update tests/openbb_terminal/test_settings_controller.py

* Black syntax formatting issues

* Fix a test case

* Fix a typo

* Fix Flake8 errors

* Fix Flake8 errors

* Pyupgrade syntax fixes

* Additional linter corrections

* More pylint issues

* Improve predefined default sources

* refactor parse_known_args_and_warn for documentation

* Update openbb_terminal/helper_funcs.py

* Add a feature flag loaded from . env for preferred data source

* Update the load command to use the preferred source

* Add a test

* Black syntax checker updates

* Update test syntax

* Update load command documentation

* Add a variable to read a sources file from

* Add a default sources.json file

* Add a helper function to read the source file and get the most relevant value

* Add some comments

* Remove older preferred data source file setting

* Add a default source file for data and use it if no user preference specifies a specific file

* Remove duplicate source file and old settings values

* Update the test file

* Update documentation string

* Update tests/openbb_terminal/test_settings_controller.py

* Black syntax formatting issues

* Fix a test case

* Fix a typo

* Fix Flake8 errors

* Fix Flake8 errors

* Pyupgrade syntax fixes

* Additional linter corrections

* More pylint issues

* Improve predefined default sources

* refactor parse_known_args_and_warn for documentation

* Update openbb_terminal/helper_funcs.py

* Forex controller

* Tests : Fixing `parse_known_args_and_warn` issue

* Comparison Analysis controller

* Tests : Comparison Analysis

* Tests : Stocks/DarkPoolShorts + Stocks/Options

* Tests : fix call_load tests

* Linting : fixing line size

Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>
Co-authored-by: Chavithra PARANA <chavithra@gmail.com>
2022-06-14 20:23:55 +02:00

72 lines
1.8 KiB
Python

import pytest
from openbb_terminal.settings_controller import SettingsController
# pylint: disable=W0621
@pytest.fixture()
def controller(mocker):
mocker.patch(
"openbb_terminal.settings_controller.obbff.USE_PROMPT_TOOLKIT",
True,
)
mocker.patch("openbb_terminal.settings_controller.session", True)
mocker.patch("openbb_terminal.settings_controller.set_key")
mocker.patch("openbb_terminal.settings_controller.obbff")
return SettingsController()
@pytest.mark.parametrize(
"other", [["sources.json.default"], ["-v", "sources.json.default"]]
)
def test_preferred_data_source_file(controller, other):
controller.call_preferred_data_source_file(other)
def test_print_help(controller):
controller.print_help()
def test_call_dt(controller):
controller.call_dt(None)
def test_call_autoscaling(controller):
controller.call_autoscaling(None)
@pytest.mark.parametrize("other", [["45"], ["-v", "45"]])
def test_call_dpi(controller, other):
controller.call_dpi(other)
@pytest.mark.parametrize("other", [["45"], ["-v", "45"]])
def test_call_height(controller, other):
controller.call_height(other)
@pytest.mark.parametrize("other", [["45"], ["-v", "45"]])
def test_call_width(controller, other):
controller.call_width(other)
@pytest.mark.parametrize("other", [["45"], ["-v", "45"]])
def test_call_pheight(controller, other):
controller.call_pheight(other)
@pytest.mark.parametrize("other", [["45"], ["-v", "45"]])
def test_call_pwidth(controller, other):
controller.call_pwidth(other)
@pytest.mark.parametrize("other", [["45"], ["-v", "45"]])
def test_call_monitor(controller, other):
controller.call_monitor(other)
@pytest.mark.parametrize("other", [["GTK3Agg"], ["-v", "GTK3Agg"], ["None"]])
def test_call_backend(controller, other):
controller.call_backend(other)