Beispiel #1
0
def test_calling_grep_returns_result_parsed_from_command_output_with_path_and_lines_number_and_bytes(
        buffer_connection,
        command_output_and_expected_result_with_path_and_lines_number_and_bytes
):
    command_output, expected_result = command_output_and_expected_result_with_path_and_lines_number_and_bytes
    buffer_connection.remote_inject_response([command_output])
    grep_cmd = Grep(connection=buffer_connection.moler_connection,
                    options='-bnH PREROUTING /etc/iptables/rules.v4')
    grep_cmd._re_fail = None
    result = grep_cmd()
    assert expected_result == result
Beispiel #2
0
def test_calling_grep_returns_result_parsed_from_command_output(
        buffer_connection, command_output_and_expected_result):
    command_output, expected_result = command_output_and_expected_result
    buffer_connection.remote_inject_response([command_output])
    grep_cmd = Grep(connection=buffer_connection.moler_connection,
                    options='Mode debconf.conf')
    result = grep_cmd()
    assert expected_result == result
Beispiel #3
0
def test_calling_grep_returns_result_parsed_from_command_output_with_path(
        buffer_connection, command_output_and_expected_result_with_path):
    command_output, expected_result = command_output_and_expected_result_with_path
    buffer_connection.remote_inject_response([command_output])
    grep_cmd = Grep(connection=buffer_connection.moler_connection,
                    options='-H PREROUTING /etc/iptables/rules.v4')
    result = grep_cmd()
    assert expected_result == result
Beispiel #4
0
def test_grep_returns_proper_command_string(buffer_connection):
    grep_cmd = Grep(buffer_connection, options="Mode debconf.conf")
    assert "grep Mode debconf.conf" == grep_cmd.command_string