예제 #1
0
 def test_failed_command(self):
     command = "rsync --foobar"
     try:
         snapshotter._run(command.split())
         assert False, "We shouldn't get here"
     except snapshotter.CalledProcessError as err:
         assert err.command == command
         assert err.output.startswith("rsync: --foobar: unknown option")
         assert err.exit_value == 1
예제 #2
0
 def test_failed_command(self):
     command = "rsync --foobar"
     try:
         snapshotter._run(command.split())
         assert False, "We shouldn't get here"
     except snapshotter.CalledProcessError as err:
         assert err.command == command
         assert err.output.startswith("rsync: --foobar: unknown option")
         assert err.exit_value == 1
예제 #3
0
    def test_debug(self, mock_check_output_function):
        """_run() should not call check_output() if debug is True."""
        snapshotter._run("command", debug=True)

        assert not mock_check_output_function.called
예제 #4
0
 def test_success_with_stdout(self):
     output = snapshotter._run("echo foo".split())
     assert output == "foo\n"
예제 #5
0
    def test_debug(self, mock_check_output_function):
        """_run() should not call check_output() if debug is True."""
        snapshotter._run("command", debug=True)

        assert not mock_check_output_function.called
예제 #6
0
 def test_success_with_stdout(self):
     output = snapshotter._run("echo foo".split())
     assert output == "foo\n"