]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git/blobdiff - tests/test_store.py
Merge branch 'dev'
[perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git] / tests / test_store.py
index 1a722b514e8057fb8472f10e0426047c9664f305..3097f6d5d49d30f97bea413c3138cac6c21683ce 100644 (file)
@@ -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):