diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-04-05 12:14:49 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-04-05 12:14:49 +0200 |
commit | e6015816224f8f405e9b1c9557f22e73b21246e8 (patch) | |
tree | dc1e22add15b904f5c960024a23fd664769a09f7 /test.py | |
parent | dcc1e201c17dd096fb757f973341e98865809f33 (diff) | |
download | Trader-e6015816224f8f405e9b1c9557f22e73b21246e8.tar.gz Trader-e6015816224f8f405e9b1c9557f22e73b21246e8.tar.zst Trader-e6015816224f8f405e9b1c9557f22e73b21246e8.zip |
Fix console helper
Diffstat (limited to 'test.py')
-rw-r--r-- | test.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -4585,22 +4585,28 @@ class MainTest(WebMockTestCase): | |||
4585 | 4585 | ||
4586 | def test_get_user_market(self): | 4586 | def test_get_user_market(self): |
4587 | with mock.patch("main.fetch_markets") as main_fetch_markets,\ | 4587 | with mock.patch("main.fetch_markets") as main_fetch_markets,\ |
4588 | mock.patch("main.parse_args") as main_parse_args,\ | ||
4588 | mock.patch("main.parse_config") as main_parse_config: | 4589 | mock.patch("main.parse_config") as main_parse_config: |
4589 | with self.subTest(debug=False): | 4590 | with self.subTest(debug=False): |
4590 | main_parse_config.return_value = ["pg_config", "report_path"] | 4591 | main_parse_args.return_value = self.market_args() |
4592 | main_parse_config.return_value = "pg_config" | ||
4591 | main_fetch_markets.return_value = [(1, {"key": "market_config"}, 3)] | 4593 | main_fetch_markets.return_value = [(1, {"key": "market_config"}, 3)] |
4592 | m = main.get_user_market("config_path.ini", 1) | 4594 | m = main.get_user_market("config_path.ini", 1) |
4593 | 4595 | ||
4594 | self.assertIsInstance(m, market.Market) | 4596 | self.assertIsInstance(m, market.Market) |
4595 | self.assertFalse(m.debug) | 4597 | self.assertFalse(m.debug) |
4598 | main_parse_args.assert_called_once_with(["--config", "config_path.ini"]) | ||
4596 | 4599 | ||
4600 | main_parse_args.reset_mock() | ||
4597 | with self.subTest(debug=True): | 4601 | with self.subTest(debug=True): |
4598 | main_parse_config.return_value = ["pg_config", "report_path"] | 4602 | main_parse_args.return_value = self.market_args(debug=True) |
4603 | main_parse_config.return_value = "pg_config" | ||
4599 | main_fetch_markets.return_value = [(1, {"key": "market_config"}, 3)] | 4604 | main_fetch_markets.return_value = [(1, {"key": "market_config"}, 3)] |
4600 | m = main.get_user_market("config_path.ini", 1, debug=True) | 4605 | m = main.get_user_market("config_path.ini", 1, debug=True) |
4601 | 4606 | ||
4602 | self.assertIsInstance(m, market.Market) | 4607 | self.assertIsInstance(m, market.Market) |
4603 | self.assertTrue(m.debug) | 4608 | self.assertTrue(m.debug) |
4609 | main_parse_args.assert_called_once_with(["--config", "config_path.ini", "--debug"]) | ||
4604 | 4610 | ||
4605 | def test_process(self): | 4611 | def test_process(self): |
4606 | with mock.patch("market.Market") as market_mock,\ | 4612 | with mock.patch("market.Market") as market_mock,\ |