aboutsummaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-01 17:39:48 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-01 17:39:48 +0100
commit065ee3422a6ee9d40136cfa6b272e951e15c2e50 (patch)
treeb93618243649704ddf6a8d16e6adee3f3650f7bc /test.py
parent23f4616a85bef7e9acc57740f889a2a0346788af (diff)
downloadTrader-065ee3422a6ee9d40136cfa6b272e951e15c2e50.tar.gz
Trader-065ee3422a6ee9d40136cfa6b272e951e15c2e50.tar.zst
Trader-065ee3422a6ee9d40136cfa6b272e951e15c2e50.zip
Add processors
Diffstat (limited to 'test.py')
-rw-r--r--test.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/test.py b/test.py
index 14b5559..235f618 100644
--- a/test.py
+++ b/test.py
@@ -2875,9 +2875,9 @@ class HelperTest(WebMockTestCase):
2875 self.assertRegex(stdout_mock.getvalue(), "impossible to store report file: FileNotFoundError;") 2875 self.assertRegex(stdout_mock.getvalue(), "impossible to store report file: FileNotFoundError;")
2876 2876
2877 @mock.patch("helper.process_sell_all__1_all_sell") 2877 @mock.patch("helper.process_sell_all__1_all_sell")
2878 @mock.patch("helper.process_sell_all__2_all_buy") 2878 @mock.patch("helper.process_sell_all__2_wait")
2879 @mock.patch("portfolio.Portfolio.wait_for_recent") 2879 @mock.patch("helper.process_sell_all__3_all_buy")
2880 def test_main_process_market(self, wait, buy, sell): 2880 def test_main_process_market(self, buy, wait, sell):
2881 with self.subTest(before=False, after=False): 2881 with self.subTest(before=False, after=False):
2882 helper.main_process_market("user", None) 2882 helper.main_process_market("user", None)
2883 2883
@@ -3117,12 +3117,22 @@ class HelperTest(WebMockTestCase):
3117 mock.call("process_sell_all__1_all_sell_end") 3117 mock.call("process_sell_all__1_all_sell_end")
3118 ]) 3118 ])
3119 3119
3120 def test_process_sell_all__2_all_buy(self): 3120 @mock.patch("portfolio.Portfolio.wait_for_recent")
3121 helper.process_sell_all__2_all_buy(self.m) 3121 def test_process_sell_all__2_wait(self, wait):
3122 helper.process_sell_all__2_wait(self.m)
3123
3124 wait.assert_called_once_with(self.m)
3125 self.m.report.log_stage.assert_has_calls([
3126 mock.call("process_sell_all__2_wait_begin"),
3127 mock.call("process_sell_all__2_wait_end")
3128 ])
3129
3130 def test_process_sell_all__3_all_buy(self):
3131 helper.process_sell_all__3_all_buy(self.m)
3122 3132
3123 self.m.balances.fetch_balances.assert_has_calls([ 3133 self.m.balances.fetch_balances.assert_has_calls([
3124 mock.call(tag="process_sell_all__2_all_buy_begin"), 3134 mock.call(tag="process_sell_all__3_all_buy_begin"),
3125 mock.call(tag="process_sell_all__2_all_buy_end"), 3135 mock.call(tag="process_sell_all__3_all_buy_end"),
3126 ]) 3136 ])
3127 self.m.prepare_trades.assert_called_with(base_currency="BTC", 3137 self.m.prepare_trades.assert_called_with(base_currency="BTC",
3128 liquidity="medium") 3138 liquidity="medium")
@@ -3131,8 +3141,8 @@ class HelperTest(WebMockTestCase):
3131 self.m.trades.run_orders.assert_called() 3141 self.m.trades.run_orders.assert_called()
3132 self.m.follow_orders.assert_called() 3142 self.m.follow_orders.assert_called()
3133 self.m.report.log_stage.assert_has_calls([ 3143 self.m.report.log_stage.assert_has_calls([
3134 mock.call("process_sell_all__2_all_buy_begin"), 3144 mock.call("process_sell_all__3_all_buy_begin"),
3135 mock.call("process_sell_all__2_all_buy_end") 3145 mock.call("process_sell_all__3_all_buy_end")
3136 ]) 3146 ])
3137 3147
3138@unittest.skipUnless("acceptance" in limits, "Acceptance skipped") 3148@unittest.skipUnless("acceptance" in limits, "Acceptance skipped")