Improve test
This commit is contained in:
parent
9cfbb21cd7
commit
6012a55828
@ -725,17 +725,21 @@ def test_api_delete_open_order(botclient, mocker, fee, markets, ticker, is_short
|
|||||||
assert 'Invalid trade_id.' in rc.json()['error']
|
assert 'Invalid trade_id.' in rc.json()['error']
|
||||||
|
|
||||||
create_mock_trades(fee, is_short=is_short)
|
create_mock_trades(fee, is_short=is_short)
|
||||||
|
|
||||||
trades = Trade.query.all()
|
|
||||||
Trade.commit()
|
Trade.commit()
|
||||||
assert len(trades) > 2
|
|
||||||
trade = Trade.get_trades([Trade.id == 6]).first()
|
|
||||||
mocker.patch('freqtrade.exchange.Exchange.fetch_order',
|
|
||||||
return_value=trade.orders[-1].to_ccxt_object())
|
|
||||||
|
|
||||||
rc = client_delete(client, f"{BASE_URI}/trades/5/open-order")
|
rc = client_delete(client, f"{BASE_URI}/trades/5/open-order")
|
||||||
assert_response(rc, 502)
|
assert_response(rc, 502)
|
||||||
assert 'No open order for trade_id' in rc.json()['error']
|
assert 'No open order for trade_id' in rc.json()['error']
|
||||||
|
trade = Trade.get_trades([Trade.id == 6]).first()
|
||||||
|
mocker.patch('freqtrade.exchange.Exchange.fetch_order',
|
||||||
|
side_effect=ExchangeError)
|
||||||
|
rc = client_delete(client, f"{BASE_URI}/trades/6/open-order")
|
||||||
|
assert_response(rc, 502)
|
||||||
|
assert 'Order not found.' in rc.json()['error']
|
||||||
|
|
||||||
|
trade = Trade.get_trades([Trade.id == 6]).first()
|
||||||
|
mocker.patch('freqtrade.exchange.Exchange.fetch_order',
|
||||||
|
return_value=trade.orders[-1].to_ccxt_object())
|
||||||
|
|
||||||
rc = client_delete(client, f"{BASE_URI}/trades/6/open-order")
|
rc = client_delete(client, f"{BASE_URI}/trades/6/open-order")
|
||||||
assert_response(rc)
|
assert_response(rc)
|
||||||
|
Loading…
Reference in New Issue
Block a user