From 3a15ffc79ea84e5ec6200545bcbf11fc6c1c6564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 8 May 2018 20:33:47 +0200 Subject: Add USDT rate to balances --- tests/test_market.py | 3 ++- tests/test_store.py | 32 +++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/test_market.py b/tests/test_market.py index 6a9ea76..2c92655 100644 --- a/tests/test_market.py +++ b/tests/test_market.py @@ -1042,6 +1042,7 @@ class ProcessorTest(WebMockTestCase): self.m.balances.fetch_balances.assert_has_calls([ mock.call(add_portfolio=True, checkpoint='end', log_tickers=True, + add_usdt=True, tag='process_foo__0_print_balances_begin') ]) @@ -1060,7 +1061,7 @@ class ProcessorTest(WebMockTestCase): processor.process_step("foo", step, {"foo":"bar"}) self.m.balances.fetch_balances.assert_called_once_with( - add_portfolio=True, log_tickers=True, + add_portfolio=True, add_usdt=True, log_tickers=True, tag='process_foo__1_print_balances_begin') def test_parse_args(self): 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): -- cgit v1.2.3