Add test for utils --dl-trades

This commit is contained in:
Matthias 2019-10-08 20:31:14 +02:00
parent 37925e7f6c
commit 1b7a09c184

View File

@ -260,3 +260,25 @@ def test_download_data_no_pairs(mocker, caplog):
with pytest.raises(OperationalException, with pytest.raises(OperationalException,
match=r"Downloading data requires a list of pairs\..*"): match=r"Downloading data requires a list of pairs\..*"):
start_download_data(pargs) start_download_data(pargs)
def test_download_data_trades(mocker, caplog):
dl_mock = mocker.patch('freqtrade.utils.refresh_backtest_trades_data',
MagicMock(return_value=[]))
convert_mock = mocker.patch('freqtrade.utils.convert_trades_to_ohlcv',
MagicMock(return_value=[]))
patch_exchange(mocker)
mocker.patch(
'freqtrade.exchange.Exchange.markets', PropertyMock(return_value={})
)
args = [
"download-data",
"--exchange", "kraken",
"--pairs", "ETH/BTC", "XRP/BTC",
"--days", "20",
"--dl-trades"
]
start_download_data(get_args(args))
assert dl_mock.call_args[1]['timerange'].starttype == "date"
assert dl_mock.call_count == 1
assert convert_mock.call_count == 1