Sha256: 6ed8e286c29f2e8b67e13aabc0af4fbee41a15f3da39ac7960ea44eb295fb19b

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

require 'test_helper'

class GitHubLdapTest < Minitest::Test
  def setup
    GitHub::Ldap.start_server

    @options = GitHub::Ldap.server_options.merge \
      host: 'localhost',
      uid:  'uid'

    @ldap = GitHub::Ldap.new(@options)
  end

  def teardown
    GitHub::Ldap.stop_server
  end

  def test_connection_with_default_options
    assert @ldap.test_connection, "Ldap connection expected to succeed"
  end

  def test_simple_tls
    assert_equal :simple_tls, @ldap.check_encryption(:ssl)
    assert_equal :simple_tls, @ldap.check_encryption('SSL')
    assert_equal :simple_tls, @ldap.check_encryption(:simple_tls)
  end

  def test_start_tls
    assert_equal :start_tls, @ldap.check_encryption(:tls)
    assert_equal :start_tls, @ldap.check_encryption('TLS')
    assert_equal :start_tls, @ldap.check_encryption(:start_tls)
  end

  def test_search_delegator
    user = @ldap.domain('dc=github,dc=com').valid_login? 'calavera', 'secret'

    result = @ldap.search(
        {:base      => 'dc=github,dc=com',
        :attributes => %w(uid),
        :filter     => Net::LDAP::Filter.eq('uid', 'calavera')})

    assert_equal 'calavera', result.first[:uid].first
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
github-ldap-1.0.11 test/ldap_test.rb
github-ldap-1.0.10 test/ldap_test.rb
github-ldap-1.0.9 test/ldap_test.rb
github-ldap-1.0.8 test/ldap_test.rb
github-ldap-1.0.7 test/ldap_test.rb
github-ldap-1.0.6 test/ldap_test.rb