Sha256: 60514169390ace7b43051ea3235939c92f7f0d659a9f5e2069ccb5b2f642e88d

Contents?: true

Size: 1.17 KB

Versions: 12

Compression:

Stored size: 1.17 KB

Contents

require 'al-test-utils'

class TestUserdel < Test::Unit::TestCase
  include AlTestUtils

  def setup
    super
    @command = File.join(@examples_dir, "userdel")
    make_ou("People")
    @user_class.instance_variable_set("@prefix", "ou=People")
  end

  priority :must

  priority :normal
  def test_non_exist_user
    ensure_delete_user("test-user") do |uid,|
      assert(!@user_class.exists?(uid))
      assert_equal([false, "User #{uid} doesn't exist.\n"], run_command(uid))
      assert(!@user_class.exists?(uid))
    end
  end

  def test_delete_user
    make_temporary_user do |user, password|
      assert_userdel_successfully(user.uid)
    end
  end

  private
  def assert_userdel_successfully(name, *args, &block)
    _wrap_assertion do
      assert(@user_class.exists?(name))
      args.concat([name])
      assert_equal([true, ""], run_command(*args, &block))
      assert(!@user_class.exists?(name))
    end
  end

  def assert_userdel_failed(name, message, *args, &block)
    _wrap_assertion do
      assert(@user_class.exists?(name))
      args.concat([name])
      assert_equal([false, message], run_command(*args, &block))
      assert(@user_class.exists?(name))
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
activeldap-1.1.0 test/test_userdel.rb
activeldap-0.9.0 test/test_userdel.rb
activeldap-0.10.0 test/test_userdel.rb
activeldap-1.0.0 test/test_userdel.rb
activeldap-1.0.2 test/test_userdel.rb
activeldap-1.0.9 test/test_userdel.rb
activeldap-1.0.1 test/test_userdel.rb
ruby-activeldap-0.8.3.1 test/test_userdel.rb
ruby-activeldap-0.8.3 test/test_userdel.rb
ruby-activeldap-0.8.2 test/test_userdel.rb
ruby-activeldap-0.8.0 test/test_userdel.rb
ruby-activeldap-0.8.1 test/test_userdel.rb