tests: have apply different fix to exit_positions test

This commit is contained in:
Matthias
2024-10-01 20:01:49 +02:00
parent 69f0ea5199
commit 476960b5b7

View File

@@ -1249,7 +1249,7 @@ def test_enter_positions(
def test_exit_positions(mocker, default_conf_usdt, limit_order, is_short, caplog) -> None:
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
mocker.patch("freqtrade.freqtradebot.FreqtradeBot.handle_trade", MagicMock(return_value=True))
mocker.patch("freqtrade.freqtradebot.FreqtradeBot.handle_trade", MagicMock(return_value=False))
mocker.patch(f"{EXMS}.fetch_order", return_value=limit_order[entry_side(is_short)])
mocker.patch(f"{EXMS}.get_trades_for_order", return_value=[])
@@ -1281,14 +1281,14 @@ def test_exit_positions(mocker, default_conf_usdt, limit_order, is_short, caplog
trades = [trade]
freqtrade.wallets.update()
n = freqtrade.exit_positions(trades)
assert n == 1
assert n == 0
# Test amount not modified by fee-logic
assert not log_has_re(r"Applying fee to amount for Trade .*", caplog)
gra = mocker.patch("freqtrade.freqtradebot.FreqtradeBot.get_real_amount", return_value=0.0)
# test amount modified by fee-logic
n = freqtrade.exit_positions(trades)
assert n == 1
assert n == 0
assert gra.call_count == 0