Skip to content

Commit 8485ceb

Browse files
committed
teamocil tests update
1 parent d97b4e1 commit 8485ceb

File tree

1 file changed

+160
-2
lines changed

1 file changed

+160
-2
lines changed

tmuxp/testsuite/test_config_teamocil.py

Lines changed: 160 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
TMUXP_DIR = os.path.join(os.path.dirname(__file__), '.tmuxp')
1616

1717
# todo, change 'root' to a cd or start_directory
18+
# todo: width in pane -> main-pain-width
19+
# todo: with_env_var
20+
# todo: clear
21+
# todo: cmd_separator
1822

1923

2024
def teamocil_to_tmuxp(sconf):
@@ -172,6 +176,30 @@ class Teamocil2Test(unittest.TestCase):
172176
}]
173177
}
174178

179+
tmuxp_dict = {
180+
'session_name': None,
181+
'windows': [
182+
{
183+
'window_name': 'sample-four-panes',
184+
'layout': 'tiled',
185+
'panes': [
186+
{
187+
'shell_command': 'pwd'
188+
},
189+
{
190+
'shell_command': 'pwd'
191+
},
192+
{
193+
'shell_command': 'pwd'
194+
},
195+
{
196+
'shell_command': 'pwd'
197+
},
198+
]
199+
}
200+
]
201+
}
202+
175203
def test_config_to_dict(self):
176204
configparser = kaptan.Kaptan(handler='yaml')
177205
test_config = configparser.import_config(self.teamocil_yaml)
@@ -219,6 +247,38 @@ class Teamocil3Test(unittest.TestCase):
219247
}]
220248
}
221249

250+
tmuxp_dict = {
251+
'session_name': None,
252+
'windows': [
253+
{
254+
'window_name': 'my-first-window',
255+
'layout': 'even-vertical',
256+
'shell_command_before': [
257+
'rbenv local 2.0.0-p0',
258+
],
259+
'shell_command_after': [
260+
'echo \'I am done initializing this pane.\''
261+
],
262+
'panes': [
263+
{
264+
'shell_command': 'git status'
265+
},
266+
{
267+
'shell_command': 'bundle exec rails server --port 4000',
268+
'focus': True
269+
},
270+
{
271+
'shell_command': [
272+
'sudo service memcached start',
273+
'sudo service mongodb start'
274+
]
275+
}
276+
]
277+
}
278+
279+
]
280+
}
281+
222282
def test_config_to_dict(self):
223283
configparser = kaptan.Kaptan(handler='yaml')
224284
test_config = configparser.import_config(self.teamocil_yaml)
@@ -246,6 +306,20 @@ class Teamocil4Test(unittest.TestCase):
246306
}]
247307
}
248308

309+
tmuxp_dict = {
310+
'session_name': None,
311+
'windows': [
312+
{
313+
'window_name': 'erb-example',
314+
'panes': [
315+
{
316+
'shell_command': 'pwd'
317+
}
318+
]
319+
}
320+
]
321+
}
322+
249323
def test_config_to_dict(self):
250324
self.maxDiff = None
251325
configparser = kaptan.Kaptan(handler='yaml')
@@ -478,7 +552,7 @@ class TeamocilLayoutsTest(unittest.TestCase):
478552
}
479553
}
480554

481-
tmuxp_yaml = [
555+
tmuxp_dict = [
482556
{
483557
'session_name': 'two-windows',
484558
'windows': [
@@ -522,8 +596,91 @@ class TeamocilLayoutsTest(unittest.TestCase):
522596
[
523597
{
524598
'window_name': 'foo',
599+
'shell_command_before': [
600+
'echo first before filter',
601+
'echo second before filter',
602+
],
603+
'shell_command_after': [
604+
'echo first after filter',
605+
'echo second after filter',
606+
],
607+
'panes': [
608+
{
609+
'shell_command': "echo 'foo'"
610+
},
611+
{
612+
'shell_command': "echo 'foo again'",
613+
}
614+
]
525615
}
526616
]
617+
},
618+
{
619+
'window-name': 'two-windows-with-custm-command-options',
620+
'windows': [
621+
{
622+
'window_name': 'foo',
623+
'clear': True,
624+
'layout': 'tiled',
625+
'panes': [
626+
{
627+
'shell_command': "echo 'foo'",
628+
},
629+
{
630+
'shell_command': "echo 'foo again'",
631+
}
632+
]
633+
},
634+
{
635+
'window_name': 'bar',
636+
'panes': [
637+
{
638+
'shell_command': [
639+
"echo 'bar'",
640+
"echo 'bar in an array'"
641+
],
642+
'target': 'bottom-right'
643+
},
644+
{
645+
'shell_command': [
646+
"echo 'bar again'"
647+
],
648+
'focus': True,
649+
}
650+
]
651+
652+
}
653+
]
654+
655+
},
656+
{
657+
'session_name': 'three-window-within-a-session',
658+
'windows': [
659+
{
660+
'window_name': 'first window',
661+
'panes': [
662+
{
663+
'shell_command': "echo 'foo'"
664+
},
665+
]
666+
},
667+
{
668+
'window_name': 'second window',
669+
'panes': [
670+
{
671+
'shell_command': "echo 'foo'"
672+
},
673+
]
674+
},
675+
{
676+
'window_name': 'third window',
677+
'panes': [
678+
{
679+
'shell_command': "echo 'foo'"
680+
},
681+
]
682+
},
683+
]
527684
}
528685

529686
]
@@ -535,7 +692,8 @@ def test_config_to_dict(self):
535692
yaml_to_dict = test_config.get()
536693
self.assertDictEqual(yaml_to_dict, self.teamocil_dict)
537694

538-
#self.assertDictEqual(teamocil_to_tmuxp(self.teamocil_dict), self.tmuxp_dict)
695+
# self.assertDictEqual(teamocil_to_tmuxp(self.teamocil_dict),
696+
# self.tmuxp_dict)
539697

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

0 commit comments

Comments
 (0)