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):
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"]
self.assertEqual([trade_mock1, trade_mock2], trade_store.pending)
+@unittest.skipUnless("unit" in limits, "Unit skipped")
class BalanceStoreTest(WebMockTestCase):
def setUp(self):
super().setUp()
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):
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)
'body': 'body',
'headers': 'headers',
'status': 200,
+ 'duration': 120,
'response': 'Hey',
'response_same_as': None,
})
'action': 'Hey'
})
+@unittest.skipUnless("unit" in limits, "Unit skipped")
class PortfolioTest(WebMockTestCase):
def setUp(self):
super().setUp()
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())