예제 #1
0
 def test_run_without_output(self):
     shell = Shell(TestShell.cmd, stdout=False, stderr=False)
     expected = 0
     with patch('subprocess.call', return_value=expected):
         actual = shell.run()
     self.assertEqual(expected, actual)
예제 #2
0
 def test_run_pos_is_called_once(self):
     shell = Shell(TestShell.cmd, stdout=True)
     shell.run_pos = Mock()
     with patch('subprocess.check_output', return_value=''):
         shell.run()
     shell.run_pos.assert_called_once_with()
예제 #3
0
 def test_run_with_stdout_stderr(self):
     shell = Shell(TestShell.cmd, stdout=True, stderr=True)
     expected = 'output'
     with patch('subprocess.check_output', return_value=expected):
         actual = shell.run()
     self.assertEqual(expected, actual)