]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git/blobdiff - test.py
Dynamically use process methods
[perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git] / test.py
diff --git a/test.py b/test.py
index 37b0e881f65405422c1a8d57e04ec7ce36e39c16..14b5559a354fb173e26f3966c31b600b1c1eeaae 100644 (file)
--- a/test.py
+++ b/test.py
@@ -693,6 +693,7 @@ class MarketTest(WebMockTestCase):
             self.assertTrue(ticker["inverted"])
             self.assertIn("original", ticker)
             self.assertEqual(10, ticker["original"]["bid"])
+            self.assertEqual(25, ticker["original"]["average"])
 
             ticker = m.get_ticker("XVG", "XMR")
             self.assertIsNone(ticker)
@@ -721,6 +722,7 @@ class MarketTest(WebMockTestCase):
             self.assertTrue(ticker["inverted"])
             self.assertIn("original", ticker)
             self.assertEqual(10, ticker["original"]["bid"])
+            self.assertEqual(25, ticker["original"]["average"])
 
             ticker = m.get_ticker("XVG", "XMR")
             self.assertIsNone(ticker)
@@ -2918,7 +2920,7 @@ class HelperTest(WebMockTestCase):
         sell.reset_mock()
         with self.subTest(action="print_balances"),\
                 mock.patch("helper.print_balances") as print_balances:
-            helper.main_process_market("user", "print_balances")
+            helper.main_process_market("user", ["print_balances"])
 
             buy.assert_not_called()
             wait.assert_not_called()
@@ -2926,17 +2928,19 @@ class HelperTest(WebMockTestCase):
             print_balances.assert_called_once_with("user")
 
         with self.subTest(action="print_orders"),\
-                mock.patch("helper.print_orders") as print_orders:
-            helper.main_process_market("user", "print_orders")
+                mock.patch("helper.print_orders") as print_orders,\
+                mock.patch("helper.print_balances") as print_balances:
+            helper.main_process_market("user", ["print_orders", "print_balances"])
 
             buy.assert_not_called()
             wait.assert_not_called()
             sell.assert_not_called()
             print_orders.assert_called_once_with("user")
+            print_balances.assert_called_once_with("user")
 
         with self.subTest(action="unknown"),\
                 self.assertRaises(NotImplementedError):
-            helper.main_process_market("user", "unknown")
+            helper.main_process_market("user", ["unknown"])
 
     @mock.patch.object(helper, "psycopg2")
     def test_fetch_markets(self, psycopg2):