X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=tests%2Ftest_store.py;h=d7620a01fa204b3805e757ad232d3c300df78ada;hb=3a15ffc79ea84e5ec6200545bcbf11fc6c1c6564;hp=58e76e0f6f081d77a0775c97e25b463fd52f972a;hpb=af928d32483535a817b62a68f2dcb215f48ed29c;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FTrader.git diff --git a/tests/test_store.py b/tests/test_store.py index 58e76e0..d7620a0 100644 --- a/tests/test_store.py +++ b/tests/test_store.py @@ -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):