Skip to content

Commit 77b4209

Browse files
author
Dave Sims
committed
Add host interface to ldap; updated tests
1 parent f052559 commit 77b4209

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

lib/github/ldap.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class Ldap
4343
#
4444
# Returns the return value of the block.
4545
def_delegator :@connection, :open
46+
def_delegator :@connection, :host
4647

4748
attr_reader :uid, :search_domains, :virtual_attributes,
4849
:membership_validator,

lib/github/ldap/user_search/active_directory.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def self.connection(ldap)
3737
auth = netldap.instance_variable_get(:@auth)
3838

3939
new({
40-
host: ldap.instance_variable_get(:@host),
40+
host: ldap.host,
4141
instrumentation_service: ldap.instrumentation_service,
4242
port: encryption ? LDAPS_GC_PORT : STANDARD_GC_PORT,
4343
auth: auth,

test/user_search/active_directory_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class GitHubLdapActiveDirectoryUserSearchTests < GitHub::Ldap::Test
55

66
def setup
7-
@ldap = GitHub::Ldap.new(options)
7+
@ldap = GitHub::Ldap.new(options.merge(host: 'ghe.dev'))
88
@ad_user_search = GitHub::Ldap::UserSearch::ActiveDirectory.new(@ldap)
99
end
1010

@@ -33,14 +33,14 @@ def test_searches_with_empty_base_dn
3333
end
3434

3535
def test_global_catalog_default_settings
36-
global_catalog = @ad_user_search.global_catalog_connection
36+
global_catalog = GitHub::Ldap::UserSearch::GlobalCatalog.connection(@ldap)
3737
instrumentation_service = global_catalog.instance_variable_get(:@instrumentation_service)
3838

3939
auth = global_catalog.instance_variable_get(:@auth)
4040
assert_equal :simple, auth[:method]
4141
assert_equal "uid=admin,dc=github,dc=com", auth[:username]
4242
assert_equal "passworD1", auth[:password]
43-
assert_equal "127.0.0.1", global_catalog.host
43+
assert_equal "ghe.dev", global_catalog.host
4444
assert_equal 3268, global_catalog.port
4545
assert_equal "MockInstrumentationService", instrumentation_service.class.name
4646
end

0 commit comments

Comments
 (0)