blob: 56be5ef6005260f427a71ca067a38ff77f4d5e56 [file] [log] [blame]
Alex0989ecf2022-03-29 13:43:21 -05001# Author: Alex Savatieiev (osavatieiev@mirantis.com; a.savex@gmail.com)
2# Copyright 2019-2022 Mirantis, Inc.
Alex3bc95f62020-03-05 17:00:04 -06003import os
4
5from tests.mocks import _res_dir
6from tests.test_base import CfgCheckerTestBase
7
8
9class TestReclassModule(CfgCheckerTestBase):
Alex9a4ad212020-10-01 18:04:25 -050010 def setUp(self):
11 # force env type to salt
12 os.environ['MCP_TYPE_FORCE'] = 'SALT'
13
14 def tearDown(self):
15 del os.environ['MCP_TYPE_FORCE']
16
Alex3bc95f62020-03-05 17:00:04 -060017 def test_reclass_list(self):
18 _models_dir = os.path.join(_res_dir, "models")
19 _args = ["list", "-p", _models_dir]
20
21 _r_code = self.run_cli(
22 "reclass",
23 _args
24 )
25 self.assertEqual(
26 _r_code,
27 0,
28 "'cmp-reclass {}' command failed".format(" ".join(_args))
29 )
30
31 def test_reclass_compare(self):
32 _models_dir = os.path.join(_res_dir, "models")
33 _model01 = os.path.join(_models_dir, "model01")
34 _model02 = os.path.join(_models_dir, "model02")
35 _report_path = os.path.join(_res_dir, "_fake.html")
36 _args = [
37 "diff",
38 "--model1",
39 _model01,
40 "--model2",
41 _model02,
42 "--html",
43 _report_path
44 ]
45
46 _r_code = self.run_cli(
47 "reclass",
48 _args
49 )
50 self.assertEqual(
51 _r_code,
52 0,
53 "'cmp-reclass {}' command failed".format(" ".join(_args))
54 )