MCPcopy Index your code
hub / github.com/bugy/script-server / test_pass_as_stdin

Method test_pass_as_stdin

src/tests/executor_test.py:165–216  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

163 self.assertEqual('xyz\n>abc< >< >< >def< ><\n', output)
164
165 def test_pass_as_stdin(self):
166 file_path = test_utils.create_file('my_script.sh', text=''&#x27;
167 sleep 0.1
168 echo -n 'ababa'
169 sleep 0.1
170 echo -n 'baba'
171 sleep 0.1
172 echo -n 'bcdef'
173 sleep 0.1
174 echo 'abc'
175 sleep 0.1
176 read input1
177 read input2
178 read input3
179 read input4
180 read input5
181 read input6
182 sleep 0.1
183 echo "inputs: '$input1' '$input2' '$input3' '$input4' '$input5' '$input6'"
184 ''&#x27;)
185
186 config = create_config_model(
187 'config_x',
188 script_command='bash ' + file_path,
189 parameters=[
190 create_script_param_config('p1', pass_as='stdin'),
191 create_script_param_config('p2', pass_as='stdin', stdin_expected_text='abc'),
192 create_script_param_config('p3', pass_as='stdin'),
193 create_script_param_config('p4', pass_as='stdin'),
194 create_script_param_config('p5', pass_as='stdin', no_value=True),
195 create_script_param_config('p6', pass_as='stdin', no_value=True),
196 create_script_param_config('p7', pass_as='stdin', stdin_expected_text='b'),
197 ],
198 parameter_values={'p1': 'xxx', 'p2': 'yyy', 'p3': [1, 3, 7], 'p5': True, 'p6': False, 'p7': 'zzz'})
199
200 executor._process_creator = create_process_wrapper
201 self.create_executor(config)
202 self.executor.start(123)
203
204 data = read_until_closed(self.executor.get_raw_output_stream(), 1000)
205 output = ''.join(data)
206
207 self.assertEqual(string_utils.dedent(''&#x27;
208 xxx
209 1,3,7
210 true
211 false
212 ababazzz
213 bababcdefyyy
214 abc
215 inputs: 'xxx' '1,3,7' 'true' 'false' 'zzz' 'yyy'
216 ''&#x27;), output)
217
218 def test_values_ui_mapping(self):
219 config = create_config_model(

Callers

nothing calls this directly

Calls 6

create_executorMethod · 0.95
create_config_modelFunction · 0.90
read_until_closedFunction · 0.90
startMethod · 0.45
get_raw_output_streamMethod · 0.45

Tested by

no test coverage detected