diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_market.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test_market.py b/tests/test_market.py index 07188ac..c029686 100644 --- a/tests/test_market.py +++ b/tests/test_market.py | |||
@@ -402,6 +402,40 @@ class MarketTest(WebMockTestCase): | |||
402 | m.report.log_order.assert_called_with(order_mock2, 2, new_order=new_order_mock) | 402 | m.report.log_order.assert_called_with(order_mock2, 2, new_order=new_order_mock) |
403 | new_order_mock.run.assert_called_once_with() | 403 | new_order_mock.run.assert_called_once_with() |
404 | 404 | ||
405 | with self.subTest("disappearing order no action to do"), \ | ||
406 | mock.patch("market.ReportStore"): | ||
407 | all_orders.reset_mock() | ||
408 | m = market.Market(self.ccxt, self.market_args()) | ||
409 | |||
410 | order_mock1 = mock.Mock() | ||
411 | order_mock2 = mock.Mock() | ||
412 | all_orders.side_effect = [ | ||
413 | [order_mock1, order_mock2], | ||
414 | [order_mock1, order_mock2], | ||
415 | |||
416 | [order_mock1, order_mock2], | ||
417 | [order_mock1, order_mock2], | ||
418 | |||
419 | [] | ||
420 | ] | ||
421 | |||
422 | order_mock1.get_status.side_effect = ["open", "closed"] | ||
423 | order_mock2.get_status.side_effect = ["open", "error_disappeared"] | ||
424 | |||
425 | order_mock1.trade = mock.Mock() | ||
426 | trade_mock = mock.Mock() | ||
427 | order_mock2.trade = trade_mock | ||
428 | |||
429 | trade_mock.tick_actions_recreate.return_value = "tick1" | ||
430 | trade_mock.prepare_order.return_value = None | ||
431 | |||
432 | m.follow_orders() | ||
433 | |||
434 | trade_mock.tick_actions_recreate.assert_called_once_with(2) | ||
435 | trade_mock.prepare_order.assert_called_once_with(compute_value="tick1") | ||
436 | m.report.log_error.assert_called_once_with("follow_orders", message=mock.ANY) | ||
437 | m.report.log_order.assert_called_with(order_mock2, 2, finished=True) | ||
438 | |||
405 | @mock.patch.object(market.BalanceStore, "fetch_balances") | 439 | @mock.patch.object(market.BalanceStore, "fetch_balances") |
406 | def test_move_balance(self, fetch_balances): | 440 | def test_move_balance(self, fetch_balances): |
407 | for debug in [True, False]: | 441 | for debug in [True, False]: |