Skip to content

Commit 61a442a

Browse files
Guillaume De Saint MartinGuillaumeDSM
Guillaume De Saint Martin
authored andcommitted
[Tests] update cancel order state tests
1 parent 460e5bf commit 61a442a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tests/personal_data/orders/states/test_cancel_order_state.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ async def test_on_order_refresh_successful(sell_limit_order):
3535
sell_limit_order.clear()
3636

3737

38-
async def test_constructor_with_pending_cancel_status(buy_limit_order):
38+
async def test_constructor_real_order_with_pending_cancel_status(buy_limit_order):
3939
# with PENDING_CANCEL status
4040
buy_limit_order.status = enums.OrderStatus.PENDING_CANCEL
41+
buy_limit_order.simulated = False
4142
state = octobot_trading.personal_data.CancelOrderState(buy_limit_order, True)
4243
assert state.state is enums.OrderStates.CANCELING
4344
assert state.is_pending()
@@ -47,6 +48,18 @@ async def test_constructor_with_pending_cancel_status(buy_limit_order):
4748
assert not state.is_status_cancelled()
4849

4950

51+
async def test_constructor_simulated_order_with_pending_cancel_status(buy_limit_order):
52+
buy_limit_order.status = enums.OrderStatus.PENDING_CANCEL
53+
buy_limit_order.simulated = True
54+
state = octobot_trading.personal_data.CancelOrderState(buy_limit_order, True)
55+
assert state.state is enums.OrderStates.CANCELED
56+
assert not state.is_pending()
57+
assert state.is_canceled()
58+
if not os.getenv('CYTHON_IGNORE'):
59+
assert not state.is_status_pending()
60+
assert state.is_status_cancelled()
61+
62+
5063
async def test_constructor_with_cancelled_status(sell_limit_order):
5164
# with CANCELED status
5265
sell_limit_order.status = enums.OrderStatus.CANCELED

0 commit comments

Comments
 (0)