Пример #1
0
 def test_output_with_stderr(self):
     output = run_script(
         ">&2 echo 'error'")
     self.assertEqual(0, output[0])
     self.assertEqual("error\n", output[1])
Пример #2
0
 def test_singleline_run_script(self):
     output = run_script("echo 'hello world'")
     self.assertEqual((0, "hello world\n"), output)
Пример #3
0
 def test_run_script_with_command(self):
     output = run_script(
         "print 'hello world'",
         command="python")
     self.assertEqual((0, "hello world\n"), output)
Пример #4
0
 def test_fail_run_script(self):
     output = run_script(
         "command_to_fail")
     self.assertEqual(127, output[0])
     self.assertTrue("line 1: command_to_fail: command not found\n" in output[1])
Пример #5
0
 def test_output_with_websocket(self):
     websocket = WebsocketLikeObject()
     output = run_script("echo 'hello world'", websocket=websocket)
     self.assertEqual((0, ""), output)
     self.assertEqual("hello world\n", websocket.data)
Пример #6
0
 def test_multiline_run_script(self):
     output = run_script(
         "#!/usr/bin/env bash\n"
         "TEXT='hello world'\n"
         "echo $TEXT\n")
     self.assertEqual((0, "hello world\n"), output)
Пример #7
0
 def test_output_with_stderr(self):
     output = run_script(">&2 echo 'error'")
     self.assertEqual(0, output[0])
     self.assertEqual("error\n", output[1])
Пример #8
0
 def test_fail_run_script(self):
     output = run_script("command_to_fail")
     self.assertEqual(127, output[0])
     self.assertTrue(
         "line 1: command_to_fail: command not found\n" in output[1])
Пример #9
0
 def test_run_script_with_command(self):
     output = run_script("print 'hello world'", command="python")
     self.assertEqual((0, "hello world\n"), output)
Пример #10
0
 def test_multiline_run_script(self):
     output = run_script("#!/usr/bin/env bash\n"
                         "TEXT='hello world'\n"
                         "echo $TEXT\n")
     self.assertEqual((0, "hello world\n"), output)
Пример #11
0
 def test_singleline_run_script(self):
     output = run_script("echo 'hello world'")
     self.assertEqual((0, "hello world\n"), output)