aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-07-25 20:29:08 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-07-25 20:29:08 +0200
commit4b598ca6f91236c94da250282ac8c89c7d947ee2 (patch)
tree15d903ed7edb9154d1a58a7b7f01cddc15429e42 /tests
parent3d6f74ee1a8b061e4b274dad70125ab6388f4d83 (diff)
downloadTrader-4b598ca6f91236c94da250282ac8c89c7d947ee2.tar.gz
Trader-4b598ca6f91236c94da250282ac8c89c7d947ee2.tar.zst
Trader-4b598ca6f91236c94da250282ac8c89c7d947ee2.zip
Some fixes
- DB cursor expects an enumerable - None should be returned when repartition is not available
Diffstat (limited to 'tests')
-rw-r--r--tests/test_main.py2
-rw-r--r--tests/test_store.py12
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/test_main.py b/tests/test_main.py
index 298e29e..0b4745f 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -333,7 +333,7 @@ class MainTest(WebMockTestCase):
333 with self.subTest(user=1): 333 with self.subTest(user=1):
334 rows = list(main.fetch_markets(1)) 334 rows = list(main.fetch_markets(1))
335 335
336 cursor_mock.execute.assert_called_once_with("SELECT id,config,user_id FROM market_configs WHERE status='enabled' AND user_id = %s", 1) 336 cursor_mock.execute.assert_called_once_with("SELECT id,config,user_id FROM market_configs WHERE status='enabled' AND user_id = %s", [1])
337 337
338 self.assertEqual(["row_1", "row_2"], rows) 338 self.assertEqual(["row_1", "row_2"], rows)
339 339
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):
1537 get_cryptoportfolio.assert_called_once_with() 1537 get_cryptoportfolio.assert_called_once_with()
1538 retrieve_cryptoportfolio.assert_called_once_with() 1538 retrieve_cryptoportfolio.assert_called_once_with()
1539 1539
1540 retrieve_cryptoportfolio.reset_mock()
1541 get_cryptoportfolio.reset_mock()
1542
1543 with self.subTest("absent liquidities"):
1544 market.Portfolio.last_date = store.LockedVar("2018-03-15")
1545 self.assertIsNone(market.Portfolio.repartition())
1546
1547 with self.subTest("no liquidities"):
1548 market.Portfolio.liquidities = store.LockedVar({})
1549 market.Portfolio.last_date = store.LockedVar("2018-03-08")
1550 self.assertIsNone(market.Portfolio.repartition())
1551
1540 @mock.patch.object(market.time, "sleep") 1552 @mock.patch.object(market.time, "sleep")
1541 @mock.patch.object(market.Portfolio, "get_cryptoportfolio") 1553 @mock.patch.object(market.Portfolio, "get_cryptoportfolio")
1542 def test_wait_for_recent(self, get_cryptoportfolio, sleep): 1554 def test_wait_for_recent(self, get_cryptoportfolio, sleep):