blob: 0b87e6dbac7cd1ced4d123371cef9eef201b325b [file] [log] [blame]
Alex265f45e2019-04-23 18:51:23 -05001from test_base import CfgCheckerTestBase
2
3
4class TestEntrypoints(CfgCheckerTestBase):
5 def test_entry_mcp_checker(self):
6 _module_name = 'cfg_checker.cfg_check'
7 with self.redirect_output():
8 _msg, _m = self._safe_import_module(_module_name)
9
10 self.assertEqual(
11 len(_msg),
12 0,
13 "Error importing '{}': {}".format(
14 _module_name,
15 _msg
16 )
17 )
18
19 with self.redirect_output():
20 with self.assertRaises(SystemExit) as ep:
21 _m.cfg_check.config_check_entrypoint()
22
23 self.assertEqual(
24 ep.exception.code,
25 0,
26 "mcp-checker has non-zero exit-code"
27 )
28
29 def test_entry_packages(self):
30 _module_name = 'cfg_checker.cli.package'
31 with self.redirect_output():
32 _msg, _m = self._safe_import_module(_module_name)
33
34 self.assertEqual(
35 len(_msg),
36 0,
37 "Error importing '{}': {}".format(
38 _module_name,
39 _msg
40 )
41 )
42
43 with self.redirect_output():
44 with self.assertRaises(SystemExit) as ep:
45 _m.cli.package.cli_package()
46
47 self.assertEqual(
48 ep.exception.code,
49 0,
50 "packages has non-zero exit code"
51 )
52
53 def test_entry_network(self):
54 _module_name = 'cfg_checker.cli.network'
55 with self.redirect_output():
56 _msg, _m = self._safe_import_module(_module_name)
57
58 self.assertEqual(
59 len(_msg),
60 0,
61 "Error importing '{}': {}".format(
62 _module_name,
63 _msg
64 )
65 )
66
67 with self.redirect_output():
68 with self.assertRaises(SystemExit) as ep:
69 _m.cli.network.cli_network()
70
71 self.assertEqual(
72 ep.exception.code,
73 0,
74 "network has non-zero exit-code"
75 )
76
77 def test_entry_reclass(self):
78 _module_name = 'cfg_checker.cli.reclass'
79 with self.redirect_output():
80 _msg, _m = self._safe_import_module(_module_name)
81
82 self.assertEqual(
83 len(_msg),
84 0,
85 "Error importing '{}': {}".format(
86 _module_name,
87 _msg
88 )
89 )
90
91 with self.redirect_output():
92 with self.assertRaises(SystemExit) as ep:
93 _m.cli.reclass.cli_reclass()
94
95 self.assertEqual(
96 ep.exception.code,
97 0,
98 "reclass has non-zero exit-code"
99 )