def setUp(self): self.r = commandRunner(tmp_id=self.id_string, tmp_path=self.tmp_path, out_globs=self.out_glob, command=self.cmd_simple, input_data=self.input_data) self.r2 = commandRunner(tmp_id=self.id_string, tmp_path=self.tmp_path, out_globs=self.out_glob, command=self.cmd_complete, input_data=self.input_data, input_string=self.input_string, output_string=self.output_string, flags=self.flags, options=self.options, std_out_str=self.std_out_str)
def test_translate_command_correctly_interpolate_options(self): """ test __translated_command works as expected """ r3 = commandRunner(tmp_id=self.id_string, tmp_path=self.tmp_path, out_globs=self.out_glob, command="ls /tmp", options={'-a': '12', 'b': '1'}) test_string = "ls -a 12 b 1 /tmp" self.assertEqual(r3.command, test_string)
def test_translate_command_correctly_interpolate_input(self): """ test __translated_command works as expected """ r3 = commandRunner(tmp_id=self.id_string, tmp_path=self.tmp_path, out_globs=self.out_glob, command="ls /tmp $INPUT", input_string="input.in") test_string = "ls /tmp input.in" self.assertEqual(r3.command, test_string)
def test_translate_command_correctly_interpolate_flags(self): """ test __translated_command works as expected """ r3 = commandRunner(tmp_id=self.id_string, tmp_path=self.tmp_path, out_globs=self.out_glob, command="ls /tmp", flags=["-ls", "ah"]) test_string = "ls -ls ah /tmp" self.assertEqual(r3.command, test_string)
def test_translate_command_correctly_appends_stdout_redirect(self): """ test __translated_command works as expected """ r3 = commandRunner(tmp_id=self.id_string, tmp_path=self.tmp_path, out_globs=self.out_glob, command="ls /tmp", std_out_str="str.stdout", options={'-a': '12', 'b': '1'}) test_string = "ls -a 12 b 1 /tmp > str.stdout" self.assertEqual(r3.command, test_string)
def test_will_take_blank_flags(self): r2 = commandRunner(tmp_id=self.id_string, tmp_path=self.tmp_path, command=self.cmd_simple) self.assertEqual(r2.options, None)
def test_will_take_blank_input_string(self): r2 = commandRunner(tmp_id=self.id_string, tmp_path=self.tmp_path, command=self.cmd_simple) self.assertEqual(r2.input_string, None)
def test_will_take_blank_out_globs(self): r3 = commandRunner(tmp_id=self.id_string, tmp_path=self.tmp_path, command=self.cmd_simple) self.assertEqual(r3.out_globs, None)
def test_will_take_blank_input_data(self): r3 = commandRunner(tmp_id=self.id_string, tmp_path=self.tmp_path, out_globs=self.out_glob, command=self.cmd_simple) self.assertEqual(r3.input_data, None)