def test_userdel_raises_command_error(buffer_connection, command_output_and_expected_result): command_output, expected_result = command_output_and_expected_result buffer_connection.remote_inject_response([command_output]) userdel_cmd = Userdel(connection=buffer_connection.moler_connection, options='-p', user='******', prompt=None, newline_chars=None) with pytest.raises(CommandFailure): userdel_cmd()
def test_userdel_returns_proper_command_string_with_option(buffer_connection): userdel_cmd = Userdel(connection=buffer_connection.moler_connection, user='******', options='-R CHROOT_DIR', prompt=None, new_line_chars=None) assert "userdel -R CHROOT_DIR xyz" == userdel_cmd.command_string
def test_userdel_raises_command_error_with_help(buffer_connection): command_output, expected_result = command_output_and_expected_result_help() buffer_connection.remote_inject_response([command_output]) userdel_cmd = Userdel(connection=buffer_connection.moler_connection, options='-f', prompt=None, new_line_chars=None) with pytest.raises(CommandFailure): userdel_cmd()
def test_userdel_returns_proper_command_string(buffer_connection): userdel_cmd = Userdel(connection=buffer_connection.moler_connection, user='******', prompt=None, newline_chars=None) assert "userdel xyz" == userdel_cmd.command_string