Skip to content

Commit 9e29c59

Browse files
committed
teamocil config add
1 parent b08305d commit 9e29c59

File tree

1 file changed

+99
-12
lines changed

1 file changed

+99
-12
lines changed

tmuxp/testsuite/test_config_teamocil.py

Lines changed: 99 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,57 @@ class TeamocilTest(unittest.TestCase):
9393
'root': '~/Code/sample/www',
9494
'layout': 'even-horizontal',
9595
'panes': [
96-
{'cmd': [
97-
'pwd',
98-
'ls -la'
96+
{
97+
'cmd': [
98+
'pwd',
99+
'ls -la'
99100
]
100-
},
101-
{'cmd': 'rails server --port 3000'}
101+
},
102+
{
103+
'cmd': 'rails server --port 3000'
104+
}
102105
]
103106
}]
104107
}
105108

109+
tmuxp_dict = {
110+
'session_name': None,
111+
'windows': [
112+
{
113+
'window_name': 'sample-two-panes',
114+
'layout': 'even-horizontal',
115+
'panes': [
116+
{
117+
'shell_command': [
118+
'pwd',
119+
'ls -la'
120+
]
121+
},
122+
{
123+
'shell_command': 'rails server --port 3000'
124+
}
125+
]
126+
}
127+
]
128+
}
129+
106130
def test_config_to_dict(self):
107131
configparser = kaptan.Kaptan(handler='yaml')
108132
test_config = configparser.import_config(self.teamocil_yaml)
109133
yaml_to_dict = test_config.get()
110134
self.assertDictEqual(yaml_to_dict, self.teamocil_dict)
111135

136+
self.assertDictEqual(
137+
teamocil_to_tmuxp(self.teamocil_dict),
138+
self.tmuxp_dict
139+
)
140+
141+
config.check_consistency(
142+
teamocil_to_tmuxp(
143+
self.teamocil_dict
144+
)
145+
)
146+
112147
def test_config_to_yaml(self):
113148
'''teamocil yaml to tmuxp yaml config
114149
@@ -175,6 +210,17 @@ def test_config_to_dict(self):
175210
yaml_to_dict = test_config.get()
176211
self.assertDictEqual(yaml_to_dict, self.teamocil_dict)
177212

213+
self.assertDictEqual(
214+
teamocil_to_tmuxp(self.teamocil_dict),
215+
self.tmuxp_dict
216+
)
217+
218+
config.check_consistency(
219+
teamocil_to_tmuxp(
220+
self.teamocil_dict
221+
)
222+
)
223+
178224

179225
class Teamocil3Test(unittest.TestCase):
180226

@@ -222,12 +268,8 @@ class Teamocil3Test(unittest.TestCase):
222268
{
223269
'window_name': 'my-first-window',
224270
'layout': 'even-vertical',
225-
'shell_command_before': [
226-
'rbenv local 2.0.0-p0',
227-
],
228-
'shell_command_after': [
229-
'echo \'I am done initializing this pane.\''
230-
],
271+
'shell_command_before': 'rbenv local 2.0.0-p0',
272+
'shell_command_after': 'echo \'I am done initializing this pane.\'',
231273
'panes': [
232274
{
233275
'shell_command': 'git status'
@@ -249,11 +291,23 @@ class Teamocil3Test(unittest.TestCase):
249291
}
250292

251293
def test_config_to_dict(self):
294+
self.maxDiff = None
252295
configparser = kaptan.Kaptan(handler='yaml')
253296
test_config = configparser.import_config(self.teamocil_yaml)
254297
yaml_to_dict = test_config.get()
255298
self.assertDictEqual(yaml_to_dict, self.teamocil_dict)
256299

300+
self.assertDictEqual(
301+
teamocil_to_tmuxp(self.teamocil_dict),
302+
self.tmuxp_dict
303+
)
304+
305+
config.check_consistency(
306+
teamocil_to_tmuxp(
307+
self.teamocil_dict
308+
)
309+
)
310+
257311

258312
class Teamocil4Test(unittest.TestCase):
259313

@@ -296,6 +350,17 @@ def test_config_to_dict(self):
296350
yaml_to_dict = test_config.get()
297351
self.assertDictEqual(yaml_to_dict, self.teamocil_dict)
298352

353+
self.assertDictEqual(
354+
teamocil_to_tmuxp(self.teamocil_dict),
355+
self.tmuxp_dict
356+
)
357+
358+
config.check_consistency(
359+
teamocil_to_tmuxp(
360+
self.teamocil_dict
361+
)
362+
)
363+
299364

300365
class TeamocilLayoutsTest(unittest.TestCase):
301366

@@ -665,27 +730,49 @@ def test_config_to_dict(self):
665730
self.two_windows
666731
)
667732

733+
config.check_consistency(
734+
teamocil_to_tmuxp(
735+
self.teamocil_dict['two-windows']
736+
)
737+
)
738+
668739
self.assertDictEqual(
669740
teamocil_to_tmuxp(
670741
self.teamocil_dict['two-windows-with-filters'],
671742
),
672743
self.two_windows_with_filters
673744
)
674745

746+
config.check_consistency(
747+
teamocil_to_tmuxp(
748+
self.teamocil_dict['two-windows-with-filters']
749+
)
750+
)
751+
675752
self.assertDictEqual(
676753
teamocil_to_tmuxp(
677754
self.teamocil_dict['two-windows-with-custom-command-options'],
678755
),
679756
self.two_windows_with_custom_command_options
680757
)
681758

759+
config.check_consistency(
760+
teamocil_to_tmuxp(
761+
self.teamocil_dict['two-windows-with-custom-command-options']
762+
)
763+
)
764+
682765
self.assertDictEqual(
683766
teamocil_to_tmuxp(
684767
self.teamocil_dict['three-windows-within-a-session'],
685768
),
686769
self.three_windows_within_a_session
687770
)
688-
771+
config.check_consistency(
772+
teamocil_to_tmuxp(
773+
self.teamocil_dict['three-windows-within-a-session']
774+
)
775+
)
689776

690777
''' this configuration contains multiple sessions in a single file.
691778
tmuxp can split them into files, proceed?

0 commit comments

Comments
 (0)