|
12 | 12 |
|
13 | 13 | from tmuxp import config |
14 | 14 |
|
15 | | -from .helpers import TestCase |
16 | 15 | from .fixtures import config_teamocil as fixtures |
17 | 16 |
|
18 | 17 | logger = logging.getLogger(__name__) |
19 | 18 | TMUXP_DIR = os.path.join(os.path.dirname(__file__), '.tmuxp') |
20 | 19 |
|
21 | 20 |
|
22 | | -class TeamocilTest(TestCase): |
23 | | - |
24 | | - teamocil_yaml = fixtures.test1.teamocil_yaml |
25 | | - teamocil_dict = fixtures.test1.teamocil_conf |
26 | | - tmuxp_dict = fixtures.test1.expected |
27 | | - |
28 | | - def test_config_to_dict(self): |
29 | | - configparser = kaptan.Kaptan(handler='yaml') |
30 | | - test_config = configparser.import_config(self.teamocil_yaml) |
31 | | - yaml_to_dict = test_config.get() |
32 | | - assert yaml_to_dict == self.teamocil_dict |
33 | | - assert config.import_teamocil(self.teamocil_dict) == self.tmuxp_dict |
34 | | - |
35 | | - config.validate_schema( |
36 | | - config.import_teamocil( |
37 | | - self.teamocil_dict |
38 | | - ) |
39 | | - ) |
40 | | - |
41 | | - |
42 | | -class Teamocil2Test(TestCase): |
43 | | - |
44 | | - teamocil_yaml = fixtures.test2.teamocil_yaml |
45 | | - teamocil_dict = fixtures.test2.teamocil_dict |
46 | | - tmuxp_dict = fixtures.test2.expected |
47 | | - |
48 | | - def test_config_to_dict(self): |
49 | | - configparser = kaptan.Kaptan(handler='yaml') |
50 | | - test_config = configparser.import_config(self.teamocil_yaml) |
51 | | - yaml_to_dict = test_config.get() |
52 | | - assert yaml_to_dict == self.teamocil_dict |
53 | | - |
54 | | - assert config.import_teamocil(self.teamocil_dict) == self.tmuxp_dict |
55 | | - |
56 | | - config.validate_schema( |
57 | | - config.import_teamocil( |
58 | | - self.teamocil_dict |
59 | | - ) |
60 | | - ) |
61 | | - |
62 | | - |
63 | | -class Teamocil3Test(TestCase): |
64 | | - |
65 | | - teamocil_yaml = fixtures.test3.teamocil_yaml |
66 | | - teamocil_dict = fixtures.test3.teamocil_dict |
67 | | - tmuxp_dict = fixtures.test3.expected |
68 | | - |
69 | | - def test_config_to_dict(self): |
70 | | - self.maxDiff = None |
71 | | - configparser = kaptan.Kaptan(handler='yaml') |
72 | | - test_config = configparser.import_config(self.teamocil_yaml) |
73 | | - yaml_to_dict = test_config.get() |
74 | | - assert yaml_to_dict == self.teamocil_dict |
75 | | - |
76 | | - assert config.import_teamocil(self.teamocil_dict) == self.tmuxp_dict |
77 | | - |
78 | | - config.validate_schema( |
79 | | - config.import_teamocil( |
80 | | - self.teamocil_dict |
81 | | - ) |
82 | | - ) |
83 | | - |
84 | | - |
85 | | -class Teamocil4Test(TestCase): |
86 | | - |
87 | | - teamocil_yaml = fixtures.test4.teamocil_yaml |
88 | | - teamocil_dict = fixtures.test4.teamocil_dict |
89 | | - tmuxp_dict = fixtures.test4.expected |
90 | | - |
91 | | - def test_config_to_dict(self): |
92 | | - self.maxDiff = None |
93 | | - configparser = kaptan.Kaptan(handler='yaml') |
94 | | - test_config = configparser.import_config(self.teamocil_yaml) |
95 | | - yaml_to_dict = test_config.get() |
96 | | - assert yaml_to_dict == self.teamocil_dict |
| 21 | +@pytest.mark.parametrize("teamocil_yaml,teamocil_dict,tmuxp_dict", [ |
| 22 | + (fixtures.test1.teamocil_yaml, fixtures.test1.teamocil_conf, |
| 23 | + fixtures.test1.expected), |
| 24 | + (fixtures.test2.teamocil_yaml, fixtures.test2.teamocil_dict, |
| 25 | + fixtures.test2.expected), |
| 26 | + (fixtures.test3.teamocil_yaml, fixtures.test3.teamocil_dict, |
| 27 | + fixtures.test3.expected), |
| 28 | + (fixtures.test4.teamocil_yaml, fixtures.test4.teamocil_dict, |
| 29 | + fixtures.test4.expected), |
| 30 | +]) |
| 31 | +def test_config_to_dict(teamocil_yaml, teamocil_dict, tmuxp_dict): |
| 32 | + configparser = kaptan.Kaptan(handler='yaml') |
| 33 | + test_config = configparser.import_config(teamocil_yaml) |
| 34 | + yaml_to_dict = test_config.get() |
| 35 | + assert yaml_to_dict == teamocil_dict |
97 | 36 |
|
98 | | - assert config.import_teamocil(self.teamocil_dict) == self.tmuxp_dict |
| 37 | + assert config.import_teamocil(teamocil_dict) == tmuxp_dict |
99 | 38 |
|
100 | | - config.validate_schema( |
101 | | - config.import_teamocil( |
102 | | - self.teamocil_dict |
103 | | - ) |
| 39 | + config.validate_schema( |
| 40 | + config.import_teamocil( |
| 41 | + teamocil_dict |
104 | 42 | ) |
| 43 | + ) |
105 | 44 |
|
106 | 45 |
|
107 | 46 | @pytest.fixture(scope='module') |
|
0 commit comments