Sha256: 381b9c6199ec19cf3f10a9dfecfd06c76850b4393509bc847f08597d8f5cd20c
Contents?: true
Size: 1.72 KB
Versions: 1
Compression:
Stored size: 1.72 KB
Contents
require_relative 'test_helper' class FilterTest < Minitest::Test class Subject include GitHub::Ldap::Filter def initialize(ldap) @ldap = ldap end end # Fake a Net::LDAP::Entry class Entry < Struct.new(:dn, :uid) def [](field) Array(send(field)) end end def setup @ldap = GitHub::Ldap.new(:uid => 'uid') @subject = Subject.new(@ldap) @me = 'uid=calavera,dc=github,dc=com' @uid = "calavera" @entry = Entry.new(@me, @uid) end def test_member_present assert_equal "(|(|(member=*)(uniqueMember=*))(memberUid=*))", @subject.member_filter.to_s end def test_member_equal assert_equal "(|(|(member=#{@me})(uniqueMember=#{@me}))(memberUid=#{@uid}))", @subject.member_filter(@entry).to_s end def test_groups_reduced assert_equal "(|(cn=Enterprise)(cn=People))", @subject.group_filter(%w(Enterprise People)).to_s end def test_members_of_group assert_equal "(memberOf=cn=group,dc=github,dc=com)", @subject.members_of_group('cn=group,dc=github,dc=com').to_s assert_equal "(isMemberOf=cn=group,dc=github,dc=com)", @subject.members_of_group('cn=group,dc=github,dc=com', 'isMemberOf').to_s end def test_subgroups_of_group assert_equal "(&(memberOf=cn=group,dc=github,dc=com)#{Subject::ALL_GROUPS_FILTER})", @subject.subgroups_of_group('cn=group,dc=github,dc=com').to_s assert_equal "(&(isMemberOf=cn=group,dc=github,dc=com)#{Subject::ALL_GROUPS_FILTER})", @subject.subgroups_of_group('cn=group,dc=github,dc=com', 'isMemberOf').to_s end def test_all_members_by_uid assert_equal "(|(uid=calavera)(uid=mtodd))", @subject.all_members_by_uid(%w(calavera mtodd), :uid).to_s end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
github-ldap-1.3.0 | test/filter_test.rb |