Improve testcase for cancel_order_empty

This commit is contained in:
Matthias 2020-04-14 19:20:47 +02:00
parent 95011919d3
commit cfe1e4876a
2 changed files with 3 additions and 1 deletions

View File

@ -908,7 +908,7 @@ class Exchange:
:param order: Order dict as returned from get_order()
:return: True if order has been cancelled without being filled, False otherwise.
"""
return order['status'] in ('closed', 'canceled') and order.get('filled') == 0.0
return order.get('status') in ('closed', 'canceled') and order.get('filled') == 0.0
@retrier
def cancel_order(self, order_id: str, pair: str) -> None:

View File

@ -1711,6 +1711,8 @@ def test_cancel_order_dry_run(default_conf, mocker, exchange_name):
({'status': 'closed', 'filled': 0.0}, True),
({'status': 'canceled', 'filled': 0.0}, True),
({'status': 'canceled', 'filled': 10.0}, False),
({'status': 'unknown', 'filled': 10.0}, False),
({'result': 'testest123'}, False),
])
def test_check_order_canceled_empty(mocker, default_conf, exchange_name, order, result):
exchange = get_patched_exchange(mocker, default_conf, id=exchange_name)