]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git/blobdiff - test.py
Add processors
[perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git] / test.py
diff --git a/test.py b/test.py
index 14b5559a354fb173e26f3966c31b600b1c1eeaae..235f6189008ae7bf67cbf5c17600c153d14db618 100644 (file)
--- a/test.py
+++ b/test.py
@@ -2875,9 +2875,9 @@ class HelperTest(WebMockTestCase):
             self.assertRegex(stdout_mock.getvalue(), "impossible to store report file: FileNotFoundError;")
 
     @mock.patch("helper.process_sell_all__1_all_sell")
-    @mock.patch("helper.process_sell_all__2_all_buy")
-    @mock.patch("portfolio.Portfolio.wait_for_recent")
-    def test_main_process_market(self, wait, buy, sell):
+    @mock.patch("helper.process_sell_all__2_wait")
+    @mock.patch("helper.process_sell_all__3_all_buy")
+    def test_main_process_market(self, buy, wait, sell):
         with self.subTest(before=False, after=False):
             helper.main_process_market("user", None)
             
@@ -3117,12 +3117,22 @@ class HelperTest(WebMockTestCase):
             mock.call("process_sell_all__1_all_sell_end")
             ])
 
-    def test_process_sell_all__2_all_buy(self):
-        helper.process_sell_all__2_all_buy(self.m)
+    @mock.patch("portfolio.Portfolio.wait_for_recent")
+    def test_process_sell_all__2_wait(self, wait):
+        helper.process_sell_all__2_wait(self.m)
+
+        wait.assert_called_once_with(self.m)
+        self.m.report.log_stage.assert_has_calls([
+            mock.call("process_sell_all__2_wait_begin"),
+            mock.call("process_sell_all__2_wait_end")
+            ])
+
+    def test_process_sell_all__3_all_buy(self):
+        helper.process_sell_all__3_all_buy(self.m)
 
         self.m.balances.fetch_balances.assert_has_calls([
-            mock.call(tag="process_sell_all__2_all_buy_begin"),
-            mock.call(tag="process_sell_all__2_all_buy_end"),
+            mock.call(tag="process_sell_all__3_all_buy_begin"),
+            mock.call(tag="process_sell_all__3_all_buy_end"),
             ])
         self.m.prepare_trades.assert_called_with(base_currency="BTC",
                 liquidity="medium")
@@ -3131,8 +3141,8 @@ class HelperTest(WebMockTestCase):
         self.m.trades.run_orders.assert_called()
         self.m.follow_orders.assert_called()
         self.m.report.log_stage.assert_has_calls([
-            mock.call("process_sell_all__2_all_buy_begin"),
-            mock.call("process_sell_all__2_all_buy_end")
+            mock.call("process_sell_all__3_all_buy_begin"),
+            mock.call("process_sell_all__3_all_buy_end")
             ])
 
 @unittest.skipUnless("acceptance" in limits, "Acceptance skipped")