Ejemplo n.º 1
0
    def test_callable(self):
        ls = shell.CommandWrapper('ls')

        with patch.object(ls, 'check_call') as mock_check_call:
            ls('-al')

        mock_check_call.assert_called_with('-al')
Ejemplo n.º 2
0
    def test_check_output(self, mock_check_output):
        ls = shell.CommandWrapper('ls')

        ls.check_output('-al')

        mock_check_output.assert_called_with(['ls', '-al'])
Ejemplo n.º 3
0
    def test_call(self, mock_call):
        ls = shell.CommandWrapper('ls')

        ls.call('-al')

        mock_call.assert_called_with(['ls', '-al'])
Ejemplo n.º 4
0
    def test_Popen(self, mock_popen):
        ls = shell.CommandWrapper('ls')

        ls.Popen('-al')

        mock_popen.assert_called_with(['ls', '-al'])
Ejemplo n.º 5
0
    def test_command_property(self):
        git = shell.CommandWrapper('git')

        self.assertEqual(git.command, ['git'])
Ejemplo n.º 6
0
    def test_command_normalized(self):
        wrapper = shell.CommandWrapper(['ls', '-al', Path('/tmp')])

        self.assertEqual(wrapper._command, ['ls', '-al', '/tmp'])