예제 #1
0
def test_cat_prompt_in_the_same_line(buffer_connection,
                                     command_output_prompt_in_the_same_line):
    buffer_connection.remote_inject_response(
        [command_output_prompt_in_the_same_line])
    cat_cmd = Cat(connection=buffer_connection.moler_connection,
                  path="/home/test/test",
                  prompt=r"^moler_bash#$")
    cat_cmd.enter_on_prompt_without_anchors = True
    cat_cmd()
    assert cat_cmd.enter_on_prompt_without_anchors is False
예제 #2
0
def test_cat_raise_exception_wrong_path_exception(buffer_connection,
                                                  command_output_exception):
    command_output = command_output_exception
    buffer_connection.remote_inject_response([command_output])
    cat_cmd = Cat(connection=buffer_connection.moler_connection,
                  path="/home/test/test")
    with pytest.raises(CommandFailure):
        cat_cmd()
예제 #3
0
def test_cat_raise_exception_wrong_path(buffer_connection,
                                        command_output_and_expected_result):
    command_output, expected_result = command_output_and_expected_result
    buffer_connection.remote_inject_response([command_output])
    cat_cmd = Cat(connection=buffer_connection.moler_connection,
                  path="/home/test/test")
    with pytest.raises(
            CommandFailure,
            match=
            r'Command failed \'cat /home/test/test\' with ERROR: Is a directory'
    ):
        cat_cmd()
예제 #4
0
def test_cat_raise_exception_wrong_path(buffer_connection, command_output):
    buffer_connection.remote_inject_response([command_output])
    cat_cmd = Cat(connection=buffer_connection.moler_connection,
                  path="/home/test/test")
    cat_cmd()
예제 #5
0
def test_cat_returns_proper_command_string(buffer_connection):
    cat_cmd = Cat(connection=buffer_connection.moler_connection,
                  path="/home/ute/test")
    assert "cat /home/ute/test" == cat_cmd.command_string