ldap_fluff 0.2.5 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ldap_fluff might be problematic. Click here for more details.

data/test/posix_test.rb CHANGED
@@ -4,15 +4,8 @@ class TestPosix < MiniTest::Test
4
4
  include LdapTestHelper
5
5
 
6
6
  def setup
7
- config
7
+ super
8
8
  @posix = LdapFluff::Posix.new(@config)
9
- @ldap = MiniTest::Mock.new
10
- end
11
-
12
- def basic_user
13
- @md = MiniTest::Mock.new
14
- @md.expect(:find_user_groups, %w(bros), %w(john))
15
- @posix.member_service = @md
16
9
  end
17
10
 
18
11
  def test_groups
@@ -21,25 +14,25 @@ class TestPosix < MiniTest::Test
21
14
  end
22
15
 
23
16
  def test_missing_user
24
- @md = MiniTest::Mock.new
25
- @md.expect(:find_user_groups, [], %w(john))
26
- @posix.member_service = @md
17
+ md = MiniTest::Mock.new
18
+ md.expect(:find_user_groups, [], %w(john))
19
+ @posix.member_service = md
27
20
  assert_equal([], @posix.groups_for_uid('john'))
28
21
  end
29
22
 
30
23
  def test_isnt_in_groups
31
24
  basic_user
32
- @md = MiniTest::Mock.new
33
- @md.expect(:times_in_groups, 0, ['john', %w(bros), true])
34
- @posix.member_service = @md
25
+ md = MiniTest::Mock.new
26
+ md.expect(:times_in_groups, 0, ['john', %w(bros), true])
27
+ @posix.member_service = md
35
28
  assert_equal(@posix.is_in_groups('john', %w(bros), true), false)
36
29
  end
37
30
 
38
31
  def test_is_in_groups
39
32
  basic_user
40
- @md = MiniTest::Mock.new
41
- @md.expect(:times_in_groups, 1, ['john', %w(bros), true])
42
- @posix.member_service = @md
33
+ md = MiniTest::Mock.new
34
+ md.expect(:times_in_groups, 1, ['john', %w(bros), true])
35
+ @posix.member_service = md
43
36
  assert_equal(@posix.is_in_groups('john', %w(bros), true), true)
44
37
  end
45
38
 
@@ -61,36 +54,59 @@ class TestPosix < MiniTest::Test
61
54
  end
62
55
 
63
56
  def test_user_exists
64
- @md = MiniTest::Mock.new
65
- @md.expect(:find_user, 'notnilluser', %w(john))
66
- @posix.member_service = @md
57
+ md = MiniTest::Mock.new
58
+ md.expect(:find_user, 'notnilluser', %w(john))
59
+ @posix.member_service = md
67
60
  assert(@posix.user_exists?('john'))
68
61
  end
69
62
 
70
63
  def test_missing_user
71
- @md = MiniTest::Mock.new
72
- @md.expect(:find_user, nil, %w(john))
73
- def @md.find_user(uid)
64
+ md = MiniTest::Mock.new
65
+ md.expect(:find_user, nil, %w(john))
66
+ def md.find_user(uid)
74
67
  raise LdapFluff::Posix::MemberService::UIDNotFoundException
75
68
  end
76
- @posix.member_service = @md
69
+ @posix.member_service = md
77
70
  refute(@posix.user_exists?('john'))
78
71
  end
79
72
 
80
73
  def test_group_exists
81
- @md = MiniTest::Mock.new
82
- @md.expect(:find_group, 'notnillgroup', %w(broskies))
83
- @posix.member_service = @md
74
+ md = MiniTest::Mock.new
75
+ md.expect(:find_group, 'notnillgroup', %w(broskies))
76
+ @posix.member_service = md
84
77
  assert(@posix.group_exists?('broskies'))
85
78
  end
86
79
 
87
80
  def test_missing_group
88
- @md = MiniTest::Mock.new
89
- @md.expect(:find_group, nil, %w(broskies))
90
- def @md.find_group(uid)
81
+ md = MiniTest::Mock.new
82
+ md.expect(:find_group, nil, %w(broskies))
83
+ def md.find_group(uid)
91
84
  raise LdapFluff::Posix::MemberService::GIDNotFoundException
92
85
  end
93
- @posix.member_service = @md
86
+ @posix.member_service = md
94
87
  refute(@posix.group_exists?('broskies'))
95
88
  end
89
+
90
+ def test_find_users_in_nested_groups
91
+ group = Net::LDAP::Entry.new('CN=foremaners,DC=example,DC=com')
92
+ group[:memberuid] = ['katellers']
93
+ nested_group = Net::LDAP::Entry.new('CN=katellers,CN=foremaners,DC=example,DC=com')
94
+ nested_group[:memberuid] = ['testuser']
95
+
96
+ @ldap.expect(:search,
97
+ [nested_group],
98
+ [{ :base => group.dn,
99
+ :filter => Net::LDAP::Filter.eq('objectClass','posixGroup') |
100
+ Net::LDAP::Filter.eq('objectClass', 'organizationalunit')}])
101
+ @posix.ldap = @ldap
102
+
103
+ md = MiniTest::Mock.new
104
+ 2.times { md.expect(:find_group, [group], ['foremaners']) }
105
+ @posix.member_service = md
106
+
107
+ assert_equal @posix.users_for_gid('foremaners'), ['testuser']
108
+
109
+ md.verify
110
+ @ldap.verify
111
+ end
96
112
  end
metadata CHANGED
@@ -1,14 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ldap_fluff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - Jordan OMara
7
+ - "'Jordan"
8
+ - OMara'
9
+ - "'Daniel"
10
+ - Lobato'
11
+ - "'Petr"
12
+ - Chalupa',
13
+ - "'Adam"
14
+ - Price'
15
+ - "'Marek"
16
+ - Hulan'
8
17
  autorequire:
9
18
  bindir: bin
10
19
  cert_chain: []
11
- date: 2014-05-29 00:00:00.000000000 Z
20
+ date: 2014-07-29 00:00:00.000000000 Z
12
21
  dependencies:
13
22
  - !ruby/object:Gem::Dependency
14
23
  name: net-ldap
@@ -28,16 +37,16 @@ dependencies:
28
37
  name: activesupport
29
38
  requirement: !ruby/object:Gem::Requirement
30
39
  requirements:
31
- - - "~>"
40
+ - - ">="
32
41
  - !ruby/object:Gem::Version
33
- version: '3.2'
42
+ version: '0'
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
- - - "~>"
47
+ - - ">="
39
48
  - !ruby/object:Gem::Version
40
- version: '3.2'
49
+ version: '0'
41
50
  - !ruby/object:Gem::Dependency
42
51
  name: rake
43
52
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +76,12 @@ dependencies:
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  description: Simple library for binding & group querying on top of various ldap implementations
70
- email: jomara@redhat.com
79
+ email:
80
+ - "'jomara@redhat.com'"
81
+ - "'elobatocs@gmail.com'"
82
+ - "'pchalupa@redhat.com'"
83
+ - "'komidore64@gmail.com'"
84
+ - "'mhulan@redhat.com'"
71
85
  executables: []
72
86
  extensions: []
73
87
  extra_rdoc_files: []
@@ -76,8 +90,11 @@ files:
76
90
  - lib/ldap_fluff/active_directory.rb
77
91
  - lib/ldap_fluff/ad_member_service.rb
78
92
  - lib/ldap_fluff/config.rb
93
+ - lib/ldap_fluff/error.rb
79
94
  - lib/ldap_fluff/freeipa.rb
80
95
  - lib/ldap_fluff/freeipa_member_service.rb
96
+ - lib/ldap_fluff/generic.rb
97
+ - lib/ldap_fluff/generic_member_service.rb
81
98
  - lib/ldap_fluff/ldap_fluff.rb
82
99
  - lib/ldap_fluff/posix.rb
83
100
  - lib/ldap_fluff/posix_member_service.rb
@@ -91,7 +108,8 @@ files:
91
108
  - test/posix_member_services_test.rb
92
109
  - test/posix_test.rb
93
110
  homepage: https://github.com/Katello/ldap_fluff
94
- licenses: []
111
+ licenses:
112
+ - GPLv2
95
113
  metadata: {}
96
114
  post_install_message:
97
115
  rdoc_options: []
@@ -109,18 +127,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
127
  version: '0'
110
128
  requirements: []
111
129
  rubyforge_project:
112
- rubygems_version: 2.2.0
130
+ rubygems_version: 2.2.2
113
131
  signing_key:
114
132
  specification_version: 4
115
133
  summary: LDAP Querying tools for Active Directory, FreeIPA and Posix-style
116
134
  test_files:
135
+ - test/posix_test.rb
136
+ - test/posix_member_services_test.rb
117
137
  - test/ad_member_services_test.rb
138
+ - test/ipa_test.rb
118
139
  - test/ad_test.rb
119
140
  - test/config_test.rb
120
- - test/ipa_member_services_test.rb
121
- - test/ipa_test.rb
122
141
  - test/ldap_test.rb
123
142
  - test/lib/ldap_test_helper.rb
124
- - test/posix_member_services_test.rb
125
- - test/posix_test.rb
143
+ - test/ipa_member_services_test.rb
126
144
  has_rdoc: true