diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_market.py | 3 | ||||
-rw-r--r-- | tests/test_store.py | 32 |
2 files changed, 33 insertions, 2 deletions
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): | |||
1042 | self.m.balances.fetch_balances.assert_has_calls([ | 1042 | self.m.balances.fetch_balances.assert_has_calls([ |
1043 | mock.call(add_portfolio=True, checkpoint='end', | 1043 | mock.call(add_portfolio=True, checkpoint='end', |
1044 | log_tickers=True, | 1044 | log_tickers=True, |
1045 | add_usdt=True, | ||
1045 | tag='process_foo__0_print_balances_begin') | 1046 | tag='process_foo__0_print_balances_begin') |
1046 | ]) | 1047 | ]) |
1047 | 1048 | ||
@@ -1060,7 +1061,7 @@ class ProcessorTest(WebMockTestCase): | |||
1060 | 1061 | ||
1061 | processor.process_step("foo", step, {"foo":"bar"}) | 1062 | processor.process_step("foo", step, {"foo":"bar"}) |
1062 | self.m.balances.fetch_balances.assert_called_once_with( | 1063 | self.m.balances.fetch_balances.assert_called_once_with( |
1063 | add_portfolio=True, log_tickers=True, | 1064 | add_portfolio=True, add_usdt=True, log_tickers=True, |
1064 | tag='process_foo__1_print_balances_begin') | 1065 | tag='process_foo__1_print_balances_begin') |
1065 | 1066 | ||
1066 | def test_parse_args(self): | 1067 | 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): | |||
392 | type='type') | 392 | type='type') |
393 | 393 | ||
394 | balance_store = market.BalanceStore(self.m) | 394 | balance_store = market.BalanceStore(self.m) |
395 | |||
396 | with self.subTest(add_portfolio=True),\ | 395 | with self.subTest(add_portfolio=True),\ |
397 | mock.patch.object(market.Portfolio, "repartition") as repartition: | 396 | mock.patch.object(market.Portfolio, "repartition") as repartition: |
398 | repartition.return_value = { | 397 | repartition.return_value = { |
@@ -402,6 +401,37 @@ class BalanceStoreTest(WebMockTestCase): | |||
402 | balance_store.fetch_balances(add_portfolio=True) | 401 | balance_store.fetch_balances(add_portfolio=True) |
403 | self.assertListEqual(["USDT", "XVG", "XMR", "DOGE"], list(balance_store.currencies())) | 402 | self.assertListEqual(["USDT", "XVG", "XMR", "DOGE"], list(balance_store.currencies())) |
404 | 403 | ||
404 | self.m.ccxt.fetch_all_balances.return_value = { | ||
405 | "ETC": { | ||
406 | "exchange_free": 0, | ||
407 | "exchange_used": 0, | ||
408 | "exchange_total": 0, | ||
409 | "margin_total": 0, | ||
410 | }, | ||
411 | "XVG": { | ||
412 | "exchange_free": 16, | ||
413 | "exchange_used": 0, | ||
414 | "exchange_total": 16, | ||
415 | "margin_total": 0, | ||
416 | }, | ||
417 | "XMR": { | ||
418 | "exchange_free": 0, | ||
419 | "exchange_used": 0, | ||
420 | "exchange_total": 0, | ||
421 | "margin_total": D("-1.0"), | ||
422 | "margin_free": 0, | ||
423 | }, | ||
424 | } | ||
425 | |||
426 | balance_store = market.BalanceStore(self.m) | ||
427 | with self.subTest(add_usdt=True),\ | ||
428 | mock.patch.object(market.Portfolio, "repartition") as repartition: | ||
429 | repartition.return_value = { | ||
430 | "DOGE": D("0.5"), | ||
431 | "ETH": D("0.5"), | ||
432 | } | ||
433 | balance_store.fetch_balances(add_usdt=True) | ||
434 | self.assertListEqual(["XVG", "XMR", "USDT"], list(balance_store.currencies())) | ||
405 | 435 | ||
406 | @mock.patch.object(market.Portfolio, "repartition") | 436 | @mock.patch.object(market.Portfolio, "repartition") |
407 | def test_dispatch_assets(self, repartition): | 437 | def test_dispatch_assets(self, repartition): |