Sha256: 5130af34f48055fe071a004a097e508d1b10382fc4a00584d275045509be6d64

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

require 'asl-test-utils'

class UserHomeDirectoryTest < Test::Unit::TestCase
  include AslTestUtils

  priority :must
  def test_validate_user_home_directory_mode
    assert_valid_user_home_directory_mode(0700) do |klass, mode|
      assert_equal(0700, mode)
    end
    assert_valid_user_home_directory_mode("0750") do |klass, mode|
      assert_equal(0750, mode)
    end
    assert_valid_user_home_directory_mode(nil) do |klass, mode|
      assert_equal(0755, mode)
    end

    assert_invalid_user_home_directory_mode("XXX")
  end

  private
  def assert_valid_user_home_directory_mode(type)
    klass = Class.new(@user_class)
    assert_nothing_raised do
      config = reference_configuration.merge(:user_home_directory_mode => type)
      klass.establish_connection(config)
      klass.ldap_mapping
    end
    yield(klass, klass.configuration[:user_home_directory_mode]) if block_given?
  ensure
    klass.remove_connection
  end

  def assert_invalid_user_home_directory_mode(type)
    klass = Class.new(@user_class)
    assert_raises(ActiveSambaLdap::InvalidConfigurationValueError) do
      config = reference_configuration.merge(:user_home_directory_mode => type)
      klass.establish_connection(config)
    end
  ensure
    klass.remove_connection
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
activesambaldap-0.0.1 test/test_user_home_directory.rb
activesambaldap-0.0.2 test/test_user_home_directory.rb
activesambaldap-0.0.3 test/test_user_home_directory.rb
activesambaldap-0.0.5 test/test_user_home_directory.rb
activesambaldap-0.0.6 test/test_user_home_directory.rb
activesambaldap-0.0.4 test/test_user_home_directory.rb