]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git/blobdiff - tests/test_store.py
Add USDT rate to balances
[perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git] / tests / test_store.py
index 58e76e0f6f081d77a0775c97e25b463fd52f972a..d7620a01fa204b3805e757ad232d3c300df78ada 100644 (file)
@@ -392,7 +392,6 @@ class BalanceStoreTest(WebMockTestCase):
                     type='type')
 
         balance_store = market.BalanceStore(self.m)
-
         with self.subTest(add_portfolio=True),\
                 mock.patch.object(market.Portfolio, "repartition") as repartition:
             repartition.return_value = {
@@ -402,6 +401,37 @@ class BalanceStoreTest(WebMockTestCase):
             balance_store.fetch_balances(add_portfolio=True)
             self.assertListEqual(["USDT", "XVG", "XMR", "DOGE"], list(balance_store.currencies()))
 
+        self.m.ccxt.fetch_all_balances.return_value = {
+                "ETC": {
+                    "exchange_free": 0,
+                    "exchange_used": 0,
+                    "exchange_total": 0,
+                    "margin_total": 0,
+                    },
+                "XVG": {
+                    "exchange_free": 16,
+                    "exchange_used": 0,
+                    "exchange_total": 16,
+                    "margin_total": 0,
+                    },
+                "XMR": {
+                    "exchange_free": 0,
+                    "exchange_used": 0,
+                    "exchange_total": 0,
+                    "margin_total": D("-1.0"),
+                    "margin_free": 0,
+                    },
+                }
+
+        balance_store = market.BalanceStore(self.m)
+        with self.subTest(add_usdt=True),\
+                mock.patch.object(market.Portfolio, "repartition") as repartition:
+            repartition.return_value = {
+                    "DOGE": D("0.5"),
+                    "ETH": D("0.5"),
+                    }
+            balance_store.fetch_balances(add_usdt=True)
+            self.assertListEqual(["XVG", "XMR", "USDT"], list(balance_store.currencies()))
 
     @mock.patch.object(market.Portfolio, "repartition")
     def test_dispatch_assets(self, repartition):