|
8 | 8 | import os |
9 | 9 |
|
10 | 10 | import kaptan |
| 11 | +import pytest |
11 | 12 |
|
12 | 13 | from tmuxp import config |
13 | 14 |
|
14 | 15 | from .fixtures import config_tmuxinator as fixtures |
15 | | -from .helpers import TestCase |
16 | 16 |
|
17 | 17 | logger = logging.getLogger(__name__) |
18 | 18 | TMUXP_DIR = os.path.join(os.path.dirname(__file__), '.tmuxp') |
19 | 19 |
|
20 | 20 |
|
21 | | -class TmuxinatorTest(TestCase): |
22 | | - |
23 | | - tmuxinator_yaml = fixtures.test1.tmuxinator_yaml |
24 | | - tmuxinator_dict = fixtures.test1.tmuxinator_dict |
25 | | - tmuxp_dict = fixtures.test1.tmuxp_dict |
26 | | - |
27 | | - def test_config_to_dict(self): |
28 | | - configparser = kaptan.Kaptan(handler='yaml') |
29 | | - test_config = configparser.import_config(self.tmuxinator_yaml) |
30 | | - yaml_to_dict = test_config.get() |
31 | | - assert yaml_to_dict == self.tmuxinator_dict |
32 | | - |
33 | | - assert config.import_tmuxinator(self.tmuxinator_dict) == \ |
34 | | - self.tmuxp_dict |
35 | | - |
36 | | - |
37 | | -class TmuxinatorDeprecationsTest(TestCase): |
38 | | - |
39 | | - """Tmuxinator uses `tabs` instead of `windows` in older versions. |
40 | | -
|
41 | | - https://github.com/aziz/tmuxinator/blob/master/lib/tmuxinator/project.rb#L18 |
42 | | -
|
43 | | - https://github.com/aziz/tmuxinator/blob/master/spec/fixtures/sample.deprecations.yml |
44 | | -
|
45 | | - LICENSE: https://github.com/aziz/tmuxinator/blob/master/LICENSE |
46 | | -
|
47 | | - """ |
48 | | - |
49 | | - tmuxinator_yaml = fixtures.test2.tmuxinator_yaml |
50 | | - tmuxinator_dict = fixtures.test2.tmuxinator_dict |
51 | | - tmuxp_dict = fixtures.test2.tmuxp_dict |
52 | | - |
53 | | - def test_config_to_dict(self): |
54 | | - self.maxDiff = None |
55 | | - configparser = kaptan.Kaptan(handler='yaml') |
56 | | - test_config = configparser.import_config(self.tmuxinator_yaml) |
57 | | - yaml_to_dict = test_config.get() |
58 | | - assert yaml_to_dict == self.tmuxinator_dict |
59 | | - |
60 | | - assert config.import_tmuxinator(self.tmuxinator_dict) == \ |
61 | | - self.tmuxp_dict |
62 | | - |
63 | | - |
64 | | -class TmuxinatoriSampleTest(TestCase): |
65 | | - |
66 | | - """Test importing <spec/fixtures/sample.yml>. |
67 | | -
|
68 | | - https://github.com/aziz/tmuxinator/blob/master/spec/fixtures/sample.yml |
69 | | -
|
70 | | - LICENSE: https://github.com/aziz/tmuxinator/blob/master/LICENSE |
71 | | -
|
72 | | - """ |
73 | | - |
74 | | - tmuxinator_yaml = fixtures.test3.tmuxinator_yaml |
75 | | - tmuxinator_dict = fixtures.test3.tmuxinator_dict |
76 | | - tmuxp_dict = fixtures.test3.tmuxp_dict |
77 | | - |
78 | | - def test_config_to_dict(self): |
79 | | - self.maxDiff = None |
80 | | - configparser = kaptan.Kaptan(handler='yaml') |
81 | | - test_config = configparser.import_config(self.tmuxinator_yaml) |
82 | | - yaml_to_dict = test_config.get() |
83 | | - assert yaml_to_dict == self.tmuxinator_dict |
84 | | - |
85 | | - assert config.import_tmuxinator(self.tmuxinator_dict) == \ |
86 | | - self.tmuxp_dict |
| 21 | +@pytest.mark.parametrize("tmuxinator_yaml,tmuxinator_dict,tmuxp_dict", [ |
| 22 | + (fixtures.test1.tmuxinator_yaml, fixtures.test1.tmuxinator_dict, |
| 23 | + fixtures.test1.expected), |
| 24 | + (fixtures.test2.tmuxinator_yaml, fixtures.test2.tmuxinator_dict, |
| 25 | + fixtures.test2.expected), # older vers use `tabs` instead of `windows` |
| 26 | + (fixtures.test3.tmuxinator_yaml, fixtures.test3.tmuxinator_dict, |
| 27 | + fixtures.test3.expected), # Test importing <spec/fixtures/sample.yml> |
| 28 | +]) |
| 29 | +def test_config_to_dict(tmuxinator_yaml, tmuxinator_dict, tmuxp_dict): |
| 30 | + configparser = kaptan.Kaptan(handler='yaml') |
| 31 | + test_config = configparser.import_config(tmuxinator_yaml) |
| 32 | + yaml_to_dict = test_config.get() |
| 33 | + assert yaml_to_dict == tmuxinator_dict |
| 34 | + |
| 35 | + assert config.import_tmuxinator(tmuxinator_dict) == tmuxp_dict |
| 36 | + |
| 37 | + config.validate_schema( |
| 38 | + config.import_tmuxinator( |
| 39 | + tmuxinator_dict |
| 40 | + ) |
| 41 | + ) |
0 commit comments