Improve test coverage
This commit is contained in:
parent
a4c8b5bf5d
commit
5e12b05424
@ -101,18 +101,21 @@ def test_destroy(default_conf, mocker, caplog):
|
|||||||
def test_init_exception(default_conf, mocker):
|
def test_init_exception(default_conf, mocker):
|
||||||
default_conf['exchange']['name'] = 'wrong_exchange_name'
|
default_conf['exchange']['name'] = 'wrong_exchange_name'
|
||||||
|
|
||||||
with pytest.raises(
|
with pytest.raises(OperationalException,
|
||||||
OperationalException,
|
match=f"Exchange {default_conf['exchange']['name']} is not supported"):
|
||||||
match='Exchange {} is not supported'.format(default_conf['exchange']['name'])):
|
|
||||||
Exchange(default_conf)
|
Exchange(default_conf)
|
||||||
|
|
||||||
default_conf['exchange']['name'] = 'binance'
|
default_conf['exchange']['name'] = 'binance'
|
||||||
with pytest.raises(
|
with pytest.raises(OperationalException,
|
||||||
OperationalException,
|
match=f"Exchange {default_conf['exchange']['name']} is not supported"):
|
||||||
match='Exchange {} is not supported'.format(default_conf['exchange']['name'])):
|
|
||||||
mocker.patch("ccxt.binance", MagicMock(side_effect=AttributeError))
|
mocker.patch("ccxt.binance", MagicMock(side_effect=AttributeError))
|
||||||
Exchange(default_conf)
|
Exchange(default_conf)
|
||||||
|
|
||||||
|
with pytest.raises(OperationalException,
|
||||||
|
match=r"Initialization of ccxt failed. Reason: DeadBeef"):
|
||||||
|
mocker.patch("ccxt.binance", MagicMock(side_effect=ccxt.BaseError("DeadBeef")))
|
||||||
|
Exchange(default_conf)
|
||||||
|
|
||||||
|
|
||||||
def test_exchange_resolver(default_conf, mocker, caplog):
|
def test_exchange_resolver(default_conf, mocker, caplog):
|
||||||
mocker.patch('freqtrade.exchange.Exchange._init_ccxt', MagicMock(return_value=MagicMock()))
|
mocker.patch('freqtrade.exchange.Exchange._init_ccxt', MagicMock(return_value=MagicMock()))
|
||||||
@ -1436,16 +1439,12 @@ def test_get_fee(default_conf, mocker, exchange_name):
|
|||||||
'get_fee', 'calculate_fee')
|
'get_fee', 'calculate_fee')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_stoploss_limit_order_unsupported_exchange(default_conf, mocker):
|
def test_stoploss_limit_order_unsupported_exchange(default_conf, mocker):
|
||||||
exchange = get_patched_exchange(mocker, default_conf, 'bittrex')
|
exchange = get_patched_exchange(mocker, default_conf, 'bittrex')
|
||||||
with pytest.raises(OperationalException, match=r"stoploss_limit is not implemented .*"):
|
with pytest.raises(OperationalException, match=r"stoploss_limit is not implemented .*"):
|
||||||
exchange.stoploss_limit(pair='ETH/BTC', amount=1, stop_price=220, rate=200)
|
exchange.stoploss_limit(pair='ETH/BTC', amount=1, stop_price=220, rate=200)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_merge_ft_has_dict(default_conf, mocker):
|
def test_merge_ft_has_dict(default_conf, mocker):
|
||||||
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
mocker.patch.multiple('freqtrade.exchange.Exchange',
|
||||||
_init_ccxt=MagicMock(return_value=MagicMock()),
|
_init_ccxt=MagicMock(return_value=MagicMock()),
|
||||||
|
Loading…
Reference in New Issue
Block a user