aboutsummaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-04-04 12:02:13 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-04-04 12:38:28 +0200
commit90d7423eec074a0ed0af680c223180f8d7e1d4e6 (patch)
tree9180ce9db30705eeea1d0139c0f580d5b09e15e7 /test.py
parent341a4b07e8c205711fff0e93dd3679708828a961 (diff)
downloadTrader-90d7423eec074a0ed0af680c223180f8d7e1d4e6.tar.gz
Trader-90d7423eec074a0ed0af680c223180f8d7e1d4e6.tar.zst
Trader-90d7423eec074a0ed0af680c223180f8d7e1d4e6.zip
Add logging at market instance creation
Diffstat (limited to 'test.py')
-rw-r--r--test.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test.py b/test.py
index a9a80c5..29403d4 100644
--- a/test.py
+++ b/test.py
@@ -1181,9 +1181,12 @@ class MarketTest(WebMockTestCase):
1181 with self.subTest(quiet=False): 1181 with self.subTest(quiet=False):
1182 m = market.Market(self.ccxt, self.market_args(quiet=False)) 1182 m = market.Market(self.ccxt, self.market_args(quiet=False))
1183 report_store.assert_called_with(m, verbose_print=True) 1183 report_store.assert_called_with(m, verbose_print=True)
1184 report_store().log_market.assert_called_once()
1185 report_store.reset_mock()
1184 with self.subTest(quiet=True): 1186 with self.subTest(quiet=True):
1185 m = market.Market(self.ccxt, self.market_args(quiet=True)) 1187 m = market.Market(self.ccxt, self.market_args(quiet=True))
1186 report_store.assert_called_with(m, verbose_print=False) 1188 report_store.assert_called_with(m, verbose_print=False)
1189 report_store().log_market.assert_called_once()
1187 1190
1188 @mock.patch("market.ccxt") 1191 @mock.patch("market.ccxt")
1189 def test_from_config(self, ccxt): 1192 def test_from_config(self, ccxt):
@@ -4346,6 +4349,25 @@ class ReportStoreTest(WebMockTestCase):
4346 'response': 'Hey' 4349 'response': 'Hey'
4347 }) 4350 })
4348 4351
4352 @mock.patch.object(market.ReportStore, "add_log")
4353 def test_log_market(self, add_log):
4354 report_store = market.ReportStore(self.m)
4355 class Args:
4356 def __init__(self):
4357 self.debug = True
4358 self.quiet = False
4359
4360 report_store.log_market(Args(), 4, 1, "report", True)
4361 add_log.assert_called_once_with({
4362 "type": "market",
4363 "commit": "$Format:%H$",
4364 "args": { "debug": True, "quiet": False },
4365 "user_id": 4,
4366 "market_id": 1,
4367 "report_path": "report",
4368 "debug": True
4369 })
4370
4349 @mock.patch.object(market.ReportStore, "print_log") 4371 @mock.patch.object(market.ReportStore, "print_log")
4350 @mock.patch.object(market.ReportStore, "add_log") 4372 @mock.patch.object(market.ReportStore, "add_log")
4351 def test_log_error(self, add_log, print_log): 4373 def test_log_error(self, add_log, print_log):