Sha256: b2103fccaf50b0d565798091abaa29e1f3edd34e4510128cdcc7b1482b610197

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

require 'al-test-utils'

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

  def test_bind
    non_anon_class = ou_class("ou=NonAnonymous")
    anon_class = ou_class("ou=Anonymous")

    assert(non_anon_class.connection.bound?)
    assert(anon_class.connection.bound?)

    anon_class.connection.unbind
    assert(!non_anon_class.connection.bound?)
    assert(!anon_class.connection.bound?)

    anon_class.connection.rebind
    assert(non_anon_class.connection.bound?)
    assert(anon_class.connection.bound?)

    assert_raises(ActiveLdap::AuthenticationError) do
      non_anon_class.establish_connection(:bind_dn => nil,
                                          :allow_anonymous => false,
                                          :retry_limit => 0)
    end

    assert(!non_anon_class.connection.bound?)
    assert(anon_class.connection.bound?)

    anon_class.connection.unbind
    assert(!non_anon_class.connection.bound?)
    assert(!anon_class.connection.bound?)

    anon_class.connection.rebind
    assert(!non_anon_class.connection.bound?)
    assert(anon_class.connection.bound?)

    anon_class.connection.unbind
    assert(!non_anon_class.connection.bound?)
    assert(!anon_class.connection.bound?)

    assert_nothing_raised do
      anon_class.establish_connection(:bind_dn => nil,
                                      :allow_anonymous => true)
    end

    assert(!non_anon_class.connection.bound?)
    assert(anon_class.connection.bound?)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby-activeldap-0.8.3.1 test/test_connection_per_class.rb
ruby-activeldap-0.8.2 test/test_connection_per_class.rb
ruby-activeldap-0.8.1 test/test_connection_per_class.rb
ruby-activeldap-0.8.0 test/test_connection_per_class.rb
ruby-activeldap-0.8.3 test/test_connection_per_class.rb