Alex | 0989ecf | 2022-03-29 13:43:21 -0500 | [diff] [blame] | 1 | # Author: Alex Savatieiev (osavatieiev@mirantis.com; a.savex@gmail.com) |
| 2 | # Copyright 2019-2022 Mirantis, Inc. |
Alex | 3bc95f6 | 2020-03-05 17:00:04 -0600 | [diff] [blame] | 3 | import os |
| 4 | |
| 5 | from tests.mocks import _res_dir |
| 6 | from tests.test_base import CfgCheckerTestBase |
| 7 | |
| 8 | |
| 9 | class TestReclassModule(CfgCheckerTestBase): |
Alex | 9a4ad21 | 2020-10-01 18:04:25 -0500 | [diff] [blame] | 10 | 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 | |
Alex | 3bc95f6 | 2020-03-05 17:00:04 -0600 | [diff] [blame] | 17 | 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 | ) |