rework exception handling (fixes #108)

This commit is contained in:
gcarq
2017-11-16 16:14:43 +01:00
parent a0bb7a61e6
commit 0bc96241d5
3 changed files with 14 additions and 9 deletions

View File

@@ -9,7 +9,7 @@ from sqlalchemy import create_engine
from freqtrade.exchange import Exchanges
from freqtrade.main import create_trade, handle_trade, close_trade_if_fulfilled, init, \
get_target_bid, _process
from freqtrade.misc import get_state, State
from freqtrade.misc import get_state, State, FreqtradeException
from freqtrade.persistence import Trade
@@ -139,7 +139,7 @@ def test_create_trade_no_stake_amount(default_conf, ticker, mocker):
get_ticker=ticker,
buy=MagicMock(return_value='mocked_limit_buy'),
get_balance=MagicMock(return_value=default_conf['stake_amount'] * 0.5))
with pytest.raises(ValueError, match=r'.*stake amount.*'):
with pytest.raises(FreqtradeException, match=r'.*stake amount.*'):
create_trade(default_conf['stake_amount'])
@@ -152,7 +152,7 @@ def test_create_trade_no_pairs(default_conf, ticker, mocker):
get_ticker=ticker,
buy=MagicMock(return_value='mocked_limit_buy'))
with pytest.raises(ValueError, match=r'.*No pair in whitelist.*'):
with pytest.raises(FreqtradeException, match=r'.*No pair in whitelist.*'):
conf = copy.deepcopy(default_conf)
conf['exchange']['pair_whitelist'] = []
mocker.patch.dict('freqtrade.main._CONF', conf)