示例#1
0
def test_runner_bad_path(shell_runner):
    with pytest.raises(shell_runner.BadRunnerError):
        shell_runner.runner('/dev/null',
                            sentinel.ssh,
                            sentinel.config,
                            sentinel.vars,
                            sentinel.timeout,
                            continue_on_fail=False)
示例#2
0
def test_runner_empty_tests(shell_runner, ssh):
    tos = mock.MagicMock()
    tos.ip = '192.168.1.1'
    tos.os_key_private_file = '~/.ssh/config'
    vars = {}
    s = ssh.SSH('192.168.1.1', 'user', 'secret')
    with mock.patch.object(shell_runner, "gather_tests", return_value=[]):
        assert shell_runner.runner(sentinel.path,
                                   s,
                                   tos,
                                   vars,
                                   sentinel.timeout,
                                   continue_on_fail=False) is True
    del s
示例#3
0
def test_runner_all_with_continue(shell_runner, ssh):
    tos = mock.MagicMock()
    tos.ip = '192.168.1.1'
    tos.os_key_private_file = '~/.ssh/config'
    vars = {}
    s = ssh.SSH('192.168.1.1', 'user', 'secret')
    with mock.patch.object(shell_runner,
                           "gather_tests",
                           return_value=["test1", "test2"]):
        with mock.patch.object(shell_runner,
                               "run_shell_test",
                               return_value=False) as mock_run:
            assert shell_runner.runner(sentinel.path,
                                       s,
                                       tos,
                                       vars,
                                       sentinel.timeout,
                                       continue_on_fail=True) is False
            assert mock_run.call_count == 2
    del s