This commit is contained in:
Matthias
2023-08-27 10:02:41 +02:00
parent 911e238494
commit 2f97b00d31

View File

@@ -2869,7 +2869,8 @@ def test_adjust_entry_maintain_replace(
fetch_ticker=ticker_usdt,
fetch_order=MagicMock(return_value=old_order),
cancel_order_with_result=cancel_order_mock,
get_fee=fee
get_fee=fee,
_dry_is_price_crossed=MagicMock(return_value=False),
)
open_trade.is_short = is_short
@@ -2893,17 +2894,13 @@ def test_adjust_entry_maintain_replace(
assert freqtrade.strategy.adjust_entry_price.call_count == 1
# Check that order is replaced
# TODO replace order at a price that can't be fullfilled
freqtrade.get_valid_enter_price_and_stake = MagicMock(return_value={100, 10, 1})
freqtrade.strategy.adjust_entry_price = MagicMock(return_value=1234)
freqtrade.process()
assert len(Order.get_open_orders()) == 1
# TODO Check why call_count at 0, possible cause of test failure
# WHY? : Because the order is fullfilled
assert freqtrade.strategy.adjust_entry_price.call_count == 2 # Failing test
freqtrade.manage_open_orders()
assert freqtrade.strategy.adjust_entry_price.call_count == 1
trades = Trade.session.scalars(
select(Trade)
.where(Order.ft_is_open.is_(True))