missing test added

This commit is contained in:
Misagh
2019-04-05 20:20:16 +02:00
parent 25d8e93a90
commit 54d068de44
2 changed files with 15 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ import pytest
import requests
from freqtrade import (DependencyException, OperationalException,
TemporaryError, constants)
TemporaryError, InvalidOrderException, constants)
from freqtrade.data.dataprovider import DataProvider
from freqtrade.freqtradebot import FreqtradeBot
from freqtrade.persistence import Trade
@@ -1052,6 +1052,15 @@ def test_handle_stoploss_on_exchange(mocker, default_conf, fee, caplog,
freqtrade.handle_stoploss_on_exchange(trade)
assert log_has('Unable to place a stoploss order on exchange: ', caplog.record_tuples)
#Fifth case: get_order returns InvalidOrder
# It should try to add stoploss order
trade.stoploss_order_id = 100
stoploss_limit.reset_mock()
mocker.patch('freqtrade.exchange.Exchange.get_order', side_effect=InvalidOrderException())
mocker.patch('freqtrade.exchange.Exchange.stoploss_limit', stoploss_limit)
freqtrade.handle_stoploss_on_exchange(trade)
assert stoploss_limit.call_count == 1
def test_handle_stoploss_on_exchange_trailing(mocker, default_conf, fee, caplog,
markets, limit_buy_order, limit_sell_order) -> None: