Add test for start_websever
This commit is contained in:
parent
134c61126e
commit
8566306010
@ -1,6 +1,7 @@
|
||||
import logging
|
||||
from typing import Any, Dict
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -32,9 +33,9 @@ def start_webserver(args: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Main entry point for webserver mode
|
||||
"""
|
||||
from freqtrade.rpc.api_server import ApiServer
|
||||
from freqtrade.configuration import Configuration
|
||||
from freqtrade.enums import RunMode
|
||||
from freqtrade.rpc.api_server import ApiServer
|
||||
|
||||
# Initialize configuration
|
||||
config = Configuration(args, RunMode.WEBSERVER).get_config()
|
||||
|
@ -16,6 +16,7 @@ from freqtrade.commands import (start_convert_data, start_create_userdir, start_
|
||||
start_test_pairlist, start_trading)
|
||||
from freqtrade.commands.deploy_commands import (clean_ui_subdir, download_and_install_ui,
|
||||
get_ui_download_url, read_ui_version)
|
||||
from freqtrade.commands.trade_commands import start_webserver
|
||||
from freqtrade.configuration import setup_utils_configuration
|
||||
from freqtrade.enums import RunMode
|
||||
from freqtrade.exceptions import OperationalException
|
||||
@ -58,6 +59,18 @@ def test_start_trading_fail(mocker, caplog):
|
||||
assert log_has('Fatal exception!', caplog)
|
||||
|
||||
|
||||
def test_start_webserver(mocker, caplog):
|
||||
|
||||
api_server_mock = mocker.patch("freqtrade.rpc.api_server.ApiServer", )
|
||||
|
||||
args = [
|
||||
'webserver',
|
||||
'-c', 'config_bittrex.json.example'
|
||||
]
|
||||
start_webserver(get_args(args))
|
||||
assert api_server_mock.call_count == 1
|
||||
|
||||
|
||||
def test_list_exchanges(capsys):
|
||||
|
||||
args = [
|
||||
|
Loading…
Reference in New Issue
Block a user