mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
Simplify some things in tests
This commit is contained in:
@@ -2939,7 +2939,6 @@ def test_check_handle_cancelled_buy(
|
|||||||
get_fee=fee
|
get_fee=fee
|
||||||
)
|
)
|
||||||
freqtrade = FreqtradeBot(default_conf_usdt)
|
freqtrade = FreqtradeBot(default_conf_usdt)
|
||||||
# open_trade.orders = []
|
|
||||||
open_trade.is_short = is_short
|
open_trade.is_short = is_short
|
||||||
Trade.session.add(open_trade)
|
Trade.session.add(open_trade)
|
||||||
Trade.commit()
|
Trade.commit()
|
||||||
@@ -2955,8 +2954,7 @@ def test_check_handle_cancelled_buy(
|
|||||||
).all()
|
).all()
|
||||||
assert len(trades) == 0
|
assert len(trades) == 0
|
||||||
exit_name = 'Buy' if is_short else 'Sell'
|
exit_name = 'Buy' if is_short else 'Sell'
|
||||||
assert log_has_re(
|
assert log_has_re(f"{exit_name} order cancelled on exchange for Trade.*", caplog)
|
||||||
f"{exit_name} order cancelled on exchange for Trade.*", caplog)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("is_short", [False, True])
|
@pytest.mark.parametrize("is_short", [False, True])
|
||||||
@@ -3287,7 +3285,7 @@ def test_manage_open_orders_partial_except(
|
|||||||
assert cancel_order_mock.call_count == 1
|
assert cancel_order_mock.call_count == 1
|
||||||
assert rpc_mock.call_count == 3
|
assert rpc_mock.call_count == 3
|
||||||
trades = Trade.session.scalars(
|
trades = Trade.session.scalars(
|
||||||
select(Trade).where(Order.ft_trade_id == Trade.id)
|
select(Trade)
|
||||||
).all()
|
).all()
|
||||||
assert len(trades) == 1
|
assert len(trades) == 1
|
||||||
# Verify that trade has been updated
|
# Verify that trade has been updated
|
||||||
@@ -4032,7 +4030,7 @@ def test_may_execute_trade_exit_after_stoploss_on_exchange_hit(
|
|||||||
freqtrade.exit_positions(trades)
|
freqtrade.exit_positions(trades)
|
||||||
assert trade
|
assert trade
|
||||||
assert trade.stoploss_order_id == '123'
|
assert trade.stoploss_order_id == '123'
|
||||||
# assert not trade.has_open_orders
|
assert not trade.has_open_orders
|
||||||
|
|
||||||
# Assuming stoploss on exchange is hit
|
# Assuming stoploss on exchange is hit
|
||||||
# stoploss_order_id should become None
|
# stoploss_order_id should become None
|
||||||
|
|||||||
Reference in New Issue
Block a user