Sha256: fd97f2e7ec63d22f0fa0160af5ceb9e96297fbdaf6c844ee2e41e9acd30b76ac

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 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.setup_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.setup_connection(config)
    end
  ensure
    klass.remove_connection
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
activesambaldap-0.1.0 test/test_user_home_directory.rb
activesambaldap-0.0.9 test/test_user_home_directory.rb
activesambaldap-0.0.8 test/test_user_home_directory.rb
ActiveSambaLdap-0.0.7 test/test_user_home_directory.rb
activesambaldap-0.0.7 test/test_user_home_directory.rb