X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Ftest_store.py;h=ffd264555f9116ac09e9e94b31cb64e0cf8fd476;hb=3080f31d1ee74104640dcff451922cd0ae88ee22;hp=408c0e88cac7a667b088233af6db26a37205f010;hpb=c8df27385e02b22d36b240fe29532e97dbba1f43;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FTrader.git diff --git a/tests/test_store.py b/tests/test_store.py index 408c0e8..ffd2645 100644 --- a/tests/test_store.py +++ b/tests/test_store.py @@ -4,12 +4,14 @@ import datetime import threading import market, portfolio, store +@unittest.skipUnless("unit" in limits, "Unit skipped") class NoopLockTest(unittest.TestCase): def test_with(self): noop_lock = store.NoopLock() with noop_lock: self.assertTrue(True) +@unittest.skipUnless("unit" in limits, "Unit skipped") class LockedVarTest(unittest.TestCase): def test_values(self): @@ -61,6 +63,7 @@ class LockedVarTest(unittest.TestCase): thread3.join() self.assertEqual("Bar", locked_var.get()[0:3]) +@unittest.skipUnless("unit" in limits, "Unit skipped") class TradeStoreTest(WebMockTestCase): def test_compute_trades(self): self.m.balances.currencies.return_value = ["XMR", "DASH", "XVG", "BTC", "ETH"] @@ -285,6 +288,7 @@ class TradeStoreTest(WebMockTestCase): self.assertEqual([trade_mock1, trade_mock2], trade_store.pending) +@unittest.skipUnless("unit" in limits, "Unit skipped") class BalanceStoreTest(WebMockTestCase): def setUp(self): super().setUp() @@ -437,6 +441,7 @@ class BalanceStoreTest(WebMockTestCase): self.assertEqual(1, as_json["BTC"]) self.assertEqual(2, as_json["ETH"]) +@unittest.skipUnless("unit" in limits, "Unit skipped") class ReportStoreTest(WebMockTestCase): def test_add_log(self): with self.subTest(market=self.m): @@ -830,6 +835,7 @@ class ReportStoreTest(WebMockTestCase): response = mock.Mock() response.status_code = 200 response.text = "Hey" + response.elapsed.total_seconds.return_value = 120 report_store.log_http_request("method", "url", "body", "headers", response) @@ -840,6 +846,7 @@ class ReportStoreTest(WebMockTestCase): 'body': 'body', 'headers': 'headers', 'status': 200, + 'duration': 120, 'response': 'Hey', 'response_same_as': None, }) @@ -995,6 +1002,7 @@ class ReportStoreTest(WebMockTestCase): 'action': 'Hey' }) +@unittest.skipUnless("unit" in limits, "Unit skipped") class PortfolioTest(WebMockTestCase): def setUp(self): super().setUp() @@ -1245,7 +1253,7 @@ class PortfolioTest(WebMockTestCase): store.Portfolio.callback.wait() - report.print_log.assert_called_once_with("Fetching cryptoportfolio") + report.print_log.assert_called_once_with("[Worker] Fetching cryptoportfolio") get.assert_called_once_with(refetch=True) sleep.assert_called_once_with(3) self.assertFalse(store.Portfolio.worker_notify.is_set())