예제 #1
0
def test_useradd_returns_proper_command_string_defaults(buffer_connection):
    useradd_cmd = Useradd(connection=buffer_connection.moler_connection,
                          defaults=True,
                          options='-e 2018-08-01',
                          prompt=None,
                          new_line_chars=None)
    assert "useradd -D -e 2018-08-01" == useradd_cmd.command_string
예제 #2
0
def test_useradd_returns_proper_command_string_user(buffer_connection):
    useradd_cmd = Useradd(connection=buffer_connection.moler_connection,
                          user='******',
                          options='-p 1234',
                          prompt=None,
                          new_line_chars=None)
    assert "useradd -p 1234 xyz" == useradd_cmd.command_string
예제 #3
0
def test_useradd_raise_command_error_with_help(buffer_connection, command_output_and_expected_result_error_help):
    command_output, expected_result = command_output_and_expected_result_error_help
    buffer_connection.remote_inject_response([command_output])
    useradd_cmd = Useradd(connection=buffer_connection.moler_connection,
                          user='******', options='-p', prompt=None, newline_chars=None)
    assert "useradd -p xyz" == useradd_cmd.command_string
    with pytest.raises(CommandFailure):
        useradd_cmd()
예제 #4
0
def test_useradd_raise_command_error(buffer_connection, command_output_and_expected_result_error):
    command_output, expected_result = command_output_and_expected_result_error
    buffer_connection.remote_inject_response([command_output])
    useradd_cmd = Useradd(connection=buffer_connection.moler_connection,
                          defaults=True, options='-p', prompt=None, newline_chars=None)
    assert "useradd -D -p" == useradd_cmd.command_string
    with pytest.raises(CommandFailure):
        useradd_cmd()