Skip to content

Commit 7654682

Browse files
committed
Test classic member search strategy
1 parent 9418bd0 commit 7654682

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

test/members/classic_test.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
require_relative '../test_helper'
2+
3+
class GitHubLdapRecursiveMembersTest < GitHub::Ldap::Test
4+
def setup
5+
@ldap = GitHub::Ldap.new(options.merge(search_domains: %w(dc=github,dc=com)))
6+
@domain = @ldap.domain("dc=github,dc=com")
7+
@entry = @domain.user?('user1')
8+
@strategy = GitHub::Ldap::Members::Classic.new(@ldap)
9+
end
10+
11+
def find_group(cn)
12+
@domain.groups([cn]).first
13+
end
14+
15+
def test_finds_group_members
16+
members = @strategy.perform(find_group("nested-group1")).map(&:dn)
17+
assert_includes members, @entry.dn
18+
end
19+
20+
def test_finds_nested_group_members
21+
members = @strategy.perform(find_group("n-depth-nested-group1")).map(&:dn)
22+
assert_includes members, @entry.dn
23+
end
24+
25+
def test_finds_deeply_nested_group_members
26+
members = @strategy.perform(find_group("n-depth-nested-group9")).map(&:dn)
27+
assert_includes members, @entry.dn
28+
end
29+
30+
def test_finds_posix_group_members
31+
members = @strategy.perform(find_group("posix-group1")).map(&:dn)
32+
assert_includes members, @entry.dn
33+
end
34+
35+
def test_does_not_respect_configured_depth_limit
36+
strategy = GitHub::Ldap::Members::Classic.new(@ldap, depth: 2)
37+
members = strategy.perform(find_group("n-depth-nested-group9")).map(&:dn)
38+
assert_includes members, @entry.dn
39+
end
40+
end

0 commit comments

Comments
 (0)