X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FTrader.git;a=blobdiff_plain;f=tests%2Ftest_store.py;fp=tests%2Ftest_store.py;h=3097f6d5d49d30f97bea413c3138cac6c21683ce;hp=1a722b514e8057fb8472f10e0426047c9664f305;hb=e1fd4859353b6968f2f4032740ff707046dbf794;hpb=311608f375c267c1498c5a98d8f6a895cf147dd9 diff --git a/tests/test_store.py b/tests/test_store.py index 1a722b5..3097f6d 100644 --- a/tests/test_store.py +++ b/tests/test_store.py @@ -1537,6 +1537,18 @@ class PortfolioTest(WebMockTestCase): get_cryptoportfolio.assert_called_once_with() retrieve_cryptoportfolio.assert_called_once_with() + retrieve_cryptoportfolio.reset_mock() + get_cryptoportfolio.reset_mock() + + with self.subTest("absent liquidities"): + market.Portfolio.last_date = store.LockedVar("2018-03-15") + self.assertIsNone(market.Portfolio.repartition()) + + with self.subTest("no liquidities"): + market.Portfolio.liquidities = store.LockedVar({}) + market.Portfolio.last_date = store.LockedVar("2018-03-08") + self.assertIsNone(market.Portfolio.repartition()) + @mock.patch.object(market.time, "sleep") @mock.patch.object(market.Portfolio, "get_cryptoportfolio") def test_wait_for_recent(self, get_cryptoportfolio, sleep):