Skip to content

Commit 3141d81

Browse files
committed
teamocil config tests to fixtures
1 parent 8cbeac7 commit 3141d81

File tree

12 files changed

+574
-549
lines changed

12 files changed

+574
-549
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import test1, test2, test3, test4, layouts # noqa
Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,275 @@
1+
from .._util import loadfixture
2+
3+
teamocil_yaml = loadfixture('config_teamocil/layouts.yaml')
4+
5+
teamocil_dict = {
6+
'two-windows': {
7+
'windows': [
8+
{
9+
'name': 'foo',
10+
'clear': True,
11+
'root': '/foo',
12+
'layout': 'tiled',
13+
'panes': [
14+
{
15+
'cmd': "echo 'foo'"
16+
},
17+
{
18+
'cmd': "echo 'foo again'"
19+
}
20+
]
21+
},
22+
{
23+
'name': 'bar',
24+
'root': '/bar',
25+
'splits': [
26+
{
27+
'cmd': [
28+
"echo 'bar'",
29+
"echo 'bar in an array'"
30+
],
31+
'target': 'bottom-right'
32+
},
33+
{
34+
'cmd': "echo 'bar again'",
35+
'focus': True,
36+
'width': 50
37+
}
38+
]
39+
40+
}
41+
]
42+
},
43+
44+
'two-windows-with-filters': {
45+
'windows': [
46+
{
47+
'name': 'foo',
48+
'root': '/foo',
49+
'filters':
50+
{
51+
'before': [
52+
'echo first before filter',
53+
'echo second before filter'
54+
],
55+
'after': [
56+
'echo first after filter',
57+
'echo second after filter',
58+
]
59+
},
60+
'panes': [
61+
{
62+
'cmd': "echo 'foo'"
63+
},
64+
{
65+
'cmd': "echo 'foo again'",
66+
'width': 50
67+
}
68+
]
69+
}
70+
]
71+
},
72+
73+
'two-windows-with-custom-command-options': {
74+
'windows': [
75+
{
76+
'name': 'foo',
77+
'cmd_separator': '\n',
78+
'with_env_var': False,
79+
'clear': True,
80+
'root': '/foo',
81+
'layout': 'tiled',
82+
'panes': [
83+
{
84+
'cmd': "echo 'foo'"
85+
},
86+
{
87+
'cmd': "echo 'foo again'"
88+
}
89+
]
90+
}, {
91+
'name': 'bar',
92+
'cmd_separator': ' && ',
93+
'with_env_var': True,
94+
'root': '/bar',
95+
'splits': [
96+
{
97+
'cmd': [
98+
"echo 'bar'",
99+
"echo 'bar in an array'"
100+
],
101+
'target': 'bottom-right'
102+
},
103+
{
104+
'cmd': "echo 'bar again'",
105+
'focus': True,
106+
'width': 50
107+
}
108+
]
109+
}]
110+
},
111+
112+
'three-windows-within-a-session': {
113+
'session': {
114+
'name': 'my awesome session',
115+
'windows': [
116+
{
117+
'name': 'first window',
118+
'panes': [
119+
{
120+
'cmd': "echo 'foo'"
121+
}
122+
]
123+
}, {
124+
'name': 'second window',
125+
'panes': [
126+
{
127+
'cmd': "echo 'foo'"}
128+
]
129+
}, {
130+
'name': 'third window',
131+
'panes': [
132+
{
133+
'cmd': "echo 'foo'"
134+
}
135+
]
136+
}
137+
]
138+
}
139+
}
140+
}
141+
142+
143+
two_windows = \
144+
{
145+
'session_name': None,
146+
'windows': [
147+
{
148+
'window_name': 'foo',
149+
'start_directory': '/foo',
150+
'clear': True,
151+
'layout': 'tiled',
152+
'panes': [
153+
{
154+
'shell_command': "echo 'foo'"
155+
},
156+
{
157+
'shell_command': "echo 'foo again'"
158+
}
159+
]
160+
},
161+
{
162+
'window_name': 'bar',
163+
'start_directory': '/bar',
164+
'panes': [
165+
{
166+
'shell_command': [
167+
"echo 'bar'",
168+
"echo 'bar in an array'"
169+
],
170+
'target': 'bottom-right'
171+
},
172+
{
173+
'shell_command': "echo 'bar again'",
174+
'focus': True,
175+
}
176+
]
177+
}
178+
]
179+
}
180+
181+
two_windows_with_filters = \
182+
{
183+
'session_name': None,
184+
'windows': [
185+
{
186+
'window_name': 'foo',
187+
'start_directory': '/foo',
188+
'shell_command_before': [
189+
'echo first before filter',
190+
'echo second before filter',
191+
],
192+
'shell_command_after': [
193+
'echo first after filter',
194+
'echo second after filter',
195+
],
196+
'panes': [
197+
{
198+
'shell_command': "echo 'foo'"
199+
},
200+
{
201+
'shell_command': "echo 'foo again'",
202+
}
203+
]
204+
}
205+
]
206+
}
207+
208+
two_windows_with_custom_command_options = {
209+
'session_name': None,
210+
'windows': [
211+
{
212+
'window_name': 'foo',
213+
'start_directory': '/foo',
214+
'clear': True,
215+
'layout': 'tiled',
216+
'panes': [
217+
{
218+
'shell_command': "echo 'foo'",
219+
},
220+
{
221+
'shell_command': "echo 'foo again'",
222+
}
223+
]
224+
},
225+
{
226+
'window_name': 'bar',
227+
'start_directory': '/bar',
228+
'panes': [
229+
{
230+
'shell_command': [
231+
"echo 'bar'",
232+
"echo 'bar in an array'"
233+
],
234+
'target': 'bottom-right'
235+
},
236+
{
237+
'shell_command': "echo 'bar again'",
238+
'focus': True,
239+
}
240+
]
241+
242+
}
243+
]
244+
245+
}
246+
247+
three_windows_within_a_session = {
248+
'session_name': 'my awesome session',
249+
'windows': [
250+
{
251+
'window_name': 'first window',
252+
'panes': [
253+
{
254+
'shell_command': "echo 'foo'"
255+
},
256+
]
257+
},
258+
{
259+
'window_name': 'second window',
260+
'panes': [
261+
{
262+
'shell_command': "echo 'foo'"
263+
},
264+
]
265+
},
266+
{
267+
'window_name': 'third window',
268+
'panes': [
269+
{
270+
'shell_command': "echo 'foo'"
271+
},
272+
]
273+
},
274+
]
275+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Simple two windows layout
2+
two-windows:
3+
windows:
4+
- name: "foo"
5+
clear: true
6+
root: "/foo"
7+
layout: "tiled"
8+
panes:
9+
- cmd: "echo 'foo'"
10+
- cmd: "echo 'foo again'"
11+
- name: "bar"
12+
root: "/bar"
13+
splits:
14+
- cmd:
15+
- "echo 'bar'"
16+
- "echo 'bar in an array'"
17+
target: bottom-right
18+
- cmd: "echo 'bar again'"
19+
focus: true
20+
width: 50
21+
22+
# Simple two windows layout with filters
23+
two-windows-with-filters:
24+
windows:
25+
- name: "foo"
26+
root: "/foo"
27+
filters:
28+
before:
29+
- "echo first before filter"
30+
- "echo second before filter"
31+
after:
32+
- "echo first after filter"
33+
- "echo second after filter"
34+
panes:
35+
- cmd: "echo 'foo'"
36+
- cmd: "echo 'foo again'"
37+
width: 50
38+
39+
two-windows-with-custom-command-options:
40+
windows:
41+
- name: "foo"
42+
cmd_separator: "\n"
43+
with_env_var: false
44+
clear: true
45+
root: "/foo"
46+
layout: "tiled"
47+
panes:
48+
- cmd: "echo 'foo'"
49+
- cmd: "echo 'foo again'"
50+
- name: "bar"
51+
cmd_separator: " && "
52+
with_env_var: true
53+
root: "/bar"
54+
splits:
55+
- cmd:
56+
- "echo 'bar'"
57+
- "echo 'bar in an array'"
58+
target: bottom-right
59+
- cmd: "echo 'bar again'"
60+
focus: true
61+
width: 50
62+
63+
three-windows-within-a-session:
64+
session:
65+
name: "my awesome session"
66+
windows:
67+
- name: "first window"
68+
panes:
69+
- cmd: "echo 'foo'"
70+
- name: "second window"
71+
panes:
72+
- cmd: "echo 'foo'"
73+
- name: "third window"
74+
panes:
75+
- cmd: "echo 'foo'"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
from .._util import loadfixture
2+
3+
teamocil_yaml = loadfixture('config_teamocil/test1.yaml')
4+
teamocil_conf = {
5+
'windows': [{
6+
'name': 'sample-two-panes',
7+
'root': '~/Code/sample/www',
8+
'layout': 'even-horizontal',
9+
'panes': [
10+
{
11+
'cmd': [
12+
'pwd',
13+
'ls -la'
14+
]
15+
},
16+
{
17+
'cmd': 'rails server --port 3000'
18+
}
19+
]
20+
}]
21+
}
22+
23+
expected = {
24+
'session_name': None,
25+
'windows': [
26+
{
27+
'window_name': 'sample-two-panes',
28+
'layout': 'even-horizontal',
29+
'start_directory': '~/Code/sample/www',
30+
'panes': [
31+
{
32+
'shell_command': [
33+
'pwd',
34+
'ls -la'
35+
]
36+
},
37+
{
38+
'shell_command': 'rails server --port 3000'
39+
}
40+
]
41+
}
42+
]
43+
}

0 commit comments

Comments
 (0)