blob: a1a94b3f7a3b7cdb83d0a51cd3387d0b373aec47 [file] [log] [blame]
Alex3bc95f62020-03-05 17:00:04 -06001import os
2
3from tests.mocks import _res_dir
4from tests.test_base import CfgCheckerTestBase
5
6
7class TestReclassModule(CfgCheckerTestBase):
Alex9a4ad212020-10-01 18:04:25 -05008 def setUp(self):
9 # force env type to salt
10 os.environ['MCP_TYPE_FORCE'] = 'SALT'
11
12 def tearDown(self):
13 del os.environ['MCP_TYPE_FORCE']
14
Alex3bc95f62020-03-05 17:00:04 -060015 def test_reclass_list(self):
16 _models_dir = os.path.join(_res_dir, "models")
17 _args = ["list", "-p", _models_dir]
18
19 _r_code = self.run_cli(
20 "reclass",
21 _args
22 )
23 self.assertEqual(
24 _r_code,
25 0,
26 "'cmp-reclass {}' command failed".format(" ".join(_args))
27 )
28
29 def test_reclass_compare(self):
30 _models_dir = os.path.join(_res_dir, "models")
31 _model01 = os.path.join(_models_dir, "model01")
32 _model02 = os.path.join(_models_dir, "model02")
33 _report_path = os.path.join(_res_dir, "_fake.html")
34 _args = [
35 "diff",
36 "--model1",
37 _model01,
38 "--model2",
39 _model02,
40 "--html",
41 _report_path
42 ]
43
44 _r_code = self.run_cli(
45 "reclass",
46 _args
47 )
48 self.assertEqual(
49 _r_code,
50 0,
51 "'cmp-reclass {}' command failed".format(" ".join(_args))
52 )