Add test for generate_plot_file

This commit is contained in:
Matthias 2019-06-16 14:03:55 +02:00
parent 488bb971ff
commit 4b7dfc64c6
2 changed files with 12 additions and 1 deletions

View File

@ -1,7 +1,6 @@
import logging import logging
from typing import List from typing import List
import arrow
import pandas as pd import pandas as pd
from pathlib import Path from pathlib import Path

View File

@ -32,6 +32,7 @@ def generage_empty_figure():
vertical_spacing=0.0001, vertical_spacing=0.0001,
) )
def test_generate_row(default_conf, caplog): def test_generate_row(default_conf, caplog):
pair = "UNITTEST/BTC" pair = "UNITTEST/BTC"
timerange = TimeRange(None, 'line', 0, -1000) timerange = TimeRange(None, 'line', 0, -1000)
@ -155,3 +156,14 @@ def test_generate_graph_no_trades(default_conf, mocker):
assert row_mock.call_count == 2 assert row_mock.call_count == 2
assert trades_mock.call_count == 1 assert trades_mock.call_count == 1
def test_generate_plot_file(mocker, caplog):
fig = generage_empty_figure()
plot_mock = mocker.patch("freqtrade.plot.plotting.plot", MagicMock())
generate_plot_file(fig, "UNITTEST/BTC", "5m")
assert plot_mock.call_count == 1
assert plot_mock.call_args[0][0] == fig
assert (plot_mock.call_args_list[0][1]['filename']
== "user_data/plots/freqtrade-plot-UNITTEST_BTC-5m.html")