rework exception handling (fixes #108)
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user