From ae967a4f4003c84e901428805c2eddae7593c99d Mon Sep 17 00:00:00 2001 From: Samuel Husso Date: Fri, 5 Jan 2018 13:43:56 +0200 Subject: [PATCH] add test to handle analyze_ticker raising exception --- freqtrade/tests/test_analyze.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/freqtrade/tests/test_analyze.py b/freqtrade/tests/test_analyze.py index 47a557e10..b726474c8 100644 --- a/freqtrade/tests/test_analyze.py +++ b/freqtrade/tests/test_analyze.py @@ -9,7 +9,6 @@ from pandas import DataFrame from freqtrade.analyze import parse_ticker_dataframe, populate_buy_trend, populate_indicators, \ get_signal, SignalType, populate_sell_trend - @pytest.fixture def result(): with open('freqtrade/tests/testdata/BTC_ETH-1.json') as data_file: @@ -63,3 +62,10 @@ def test_returns_latest_sell_signal(mocker): return_value=DataFrame([{'sell': 0, 'date': arrow.utcnow()}]) ) assert not get_signal('BTC-ETH', SignalType.SELL) + +def test_get_signal_handles_exceptions(mocker): + mocker.patch('freqtrade.analyze.get_ticker_history', return_value=MagicMock()) + mocker.patch('freqtrade.analyze.analyze_ticker', + side_effect=Exception('invalid ticker history ')) + + assert not get_signal('BTC-ETH', SignalType.BUY)