Sha256: 222ab0b716c7ac20b435d89c02f53eb19ffd647149d97a9ed84425fe04fd4f31

Contents?: true

Size: 1.52 KB

Versions: 3

Compression:

Stored size: 1.52 KB

Contents

require 'al-test-utils'

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

  priority :must

  priority :normal
  def test_case_insensitive_match
    assert_nothing_raised do
      @group_class.instantiate(["cn=test-group,#{@group_class.base}",
                                {
                                  :cn => "test-group",
                                  :objectClass => ["TOP", "posixgroup"],
                                }])
    end
  end

  def test_ensure_recommended_classes
    make_temporary_group do |group|
      added_class = "labeledURIObject"

      assert_equal([], group.class.recommended_classes)
      group.class.recommended_classes += [added_class]
      assert_equal([added_class], group.class.recommended_classes)

      assert_equal([added_class],
                   group.class.recommended_classes - group.classes)
      group.ensure_recommended_classes
      assert_equal([],
                   group.class.recommended_classes - group.classes)
    end
  end

  def test_unknown_object_class
    make_temporary_group do |group|
      assert_raises(ActiveLdap::ObjectClassError) do
        group.add_class("unknownObjectClass")
      end
    end
  end

  def test_remove_required_class
    make_temporary_group do |group|
      assert_raises(ActiveLdap::RequiredObjectClassMissed) do
        group.remove_class("posixGroup")
      end
    end
  end

  def test_invalid_object_class_value
    make_temporary_group do |group|
      assert_raises(TypeError) {group.add_class(:posixAccount)}
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
activeldap-0.9.0 test/test_object_class.rb
ruby-activeldap-0.8.3 test/test_object_class.rb
ruby-activeldap-0.8.3.1 test/test_object_class.rb