Add test for start_list_data

This commit is contained in:
Matthias 2020-07-12 10:01:37 +02:00
parent 02afde857d
commit 5bb81abce2

View File

@ -6,12 +6,12 @@ import pytest
from freqtrade.commands import (start_convert_data, start_create_userdir, from freqtrade.commands import (start_convert_data, start_create_userdir,
start_download_data, start_hyperopt_list, start_download_data, start_hyperopt_list,
start_hyperopt_show, start_list_exchanges, start_hyperopt_show, start_list_data,
start_list_hyperopts, start_list_markets, start_list_exchanges, start_list_hyperopts,
start_list_strategies, start_list_timeframes, start_list_markets, start_list_strategies,
start_new_hyperopt, start_new_strategy, start_list_timeframes, start_new_hyperopt,
start_show_trades, start_test_pairlist, start_new_strategy, start_show_trades,
start_trading) start_test_pairlist, start_trading)
from freqtrade.configuration import setup_utils_configuration from freqtrade.configuration import setup_utils_configuration
from freqtrade.exceptions import OperationalException from freqtrade.exceptions import OperationalException
from freqtrade.state import RunMode from freqtrade.state import RunMode
@ -1043,6 +1043,23 @@ def test_convert_data_trades(mocker, testdatadir):
assert trades_mock.call_args[1]['erase'] is False assert trades_mock.call_args[1]['erase'] is False
def test_start_list_data(testdatadir, capsys):
args = [
"list-data",
"--data-format-ohlcv",
"json",
"--datadir",
str(testdatadir),
]
pargs = get_args(args)
pargs['config'] = None
start_list_data(pargs)
captured = capsys.readouterr()
assert "Found 16 pair / timeframe combinations." in captured.out
assert "\npairs timeframe\n" in captured.out
assert "\nUNITTEST/BTC 1m, 5m, 8m, 30m\n" in captured.out
@pytest.mark.usefixtures("init_persistence") @pytest.mark.usefixtures("init_persistence")
def test_show_trades(mocker, fee, capsys, caplog): def test_show_trades(mocker, fee, capsys, caplog):
mocker.patch("freqtrade.persistence.init") mocker.patch("freqtrade.persistence.init")