Improve tests to use open_order mock where applicable

This commit is contained in:
Matthias
2020-08-13 13:33:45 +02:00
parent 420a8c2b1c
commit ee7b235cdc
3 changed files with 103 additions and 87 deletions

View File

@@ -820,7 +820,7 @@ def markets_empty():
@pytest.fixture(scope='function')
def limit_buy_order():
def limit_buy_order_open():
return {
'id': 'mocked_limit_buy',
'type': 'limit',
@@ -830,13 +830,22 @@ def limit_buy_order():
'timestamp': arrow.utcnow().timestamp,
'price': 0.00001099,
'amount': 90.99181073,
'filled': 90.99181073,
'filled': 0.0,
'cost': 0.0009999,
'remaining': 0.0,
'status': 'closed'
'remaining': 90.99181073,
'status': 'open'
}
@pytest.fixture(scope='function')
def limit_buy_order(limit_buy_order_open):
order = deepcopy(limit_buy_order_open)
order['status'] = 'closed'
order['filled'] = order['amount']
order['remaining'] = 0.0
return order
@pytest.fixture(scope='function')
def market_buy_order():
return {
@@ -1019,21 +1028,31 @@ def limit_buy_order_canceled_empty(request):
@pytest.fixture
def limit_sell_order():
def limit_sell_order_open():
return {
'id': 'mocked_limit_sell',
'type': 'limit',
'side': 'sell',
'pair': 'mocked',
'datetime': arrow.utcnow().isoformat(),
'timestamp': arrow.utcnow().timestamp,
'price': 0.00001173,
'amount': 90.99181073,
'filled': 90.99181073,
'remaining': 0.0,
'status': 'closed'
'filled': 0.0,
'remaining': 90.99181073,
'status': 'open'
}
@pytest.fixture
def limit_sell_order(limit_sell_order_open):
order = deepcopy(limit_sell_order_open)
order['remaining'] = 0.0
order['filled'] = order['amount']
order['status'] = 'closed'
return order
@pytest.fixture
def order_book_l2():
return MagicMock(return_value={