fakeldap 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/LICENSE +20 -0
  2. data/README.md +3 -0
  3. data/lib/fakeldap.rb +46 -0
  4. data/lib/fakeldap/version.rb +4 -0
  5. data/vendor/ruby-ldapserver/COPYING +27 -0
  6. data/vendor/ruby-ldapserver/ChangeLog +83 -0
  7. data/vendor/ruby-ldapserver/Manifest.txt +32 -0
  8. data/vendor/ruby-ldapserver/README +222 -0
  9. data/vendor/ruby-ldapserver/Rakefile +22 -0
  10. data/vendor/ruby-ldapserver/examples/README +89 -0
  11. data/vendor/ruby-ldapserver/examples/mkcert.rb +31 -0
  12. data/vendor/ruby-ldapserver/examples/rbslapd1.rb +111 -0
  13. data/vendor/ruby-ldapserver/examples/rbslapd2.rb +161 -0
  14. data/vendor/ruby-ldapserver/examples/rbslapd3.rb +172 -0
  15. data/vendor/ruby-ldapserver/examples/speedtest.rb +37 -0
  16. data/vendor/ruby-ldapserver/lib/ldap/server.rb +4 -0
  17. data/vendor/ruby-ldapserver/lib/ldap/server/connection.rb +276 -0
  18. data/vendor/ruby-ldapserver/lib/ldap/server/filter.rb +223 -0
  19. data/vendor/ruby-ldapserver/lib/ldap/server/match.rb +283 -0
  20. data/vendor/ruby-ldapserver/lib/ldap/server/operation.rb +487 -0
  21. data/vendor/ruby-ldapserver/lib/ldap/server/preforkserver.rb +93 -0
  22. data/vendor/ruby-ldapserver/lib/ldap/server/result.rb +71 -0
  23. data/vendor/ruby-ldapserver/lib/ldap/server/schema.rb +592 -0
  24. data/vendor/ruby-ldapserver/lib/ldap/server/server.rb +89 -0
  25. data/vendor/ruby-ldapserver/lib/ldap/server/syntax.rb +235 -0
  26. data/vendor/ruby-ldapserver/lib/ldap/server/tcpserver.rb +91 -0
  27. data/vendor/ruby-ldapserver/lib/ldap/server/util.rb +88 -0
  28. data/vendor/ruby-ldapserver/lib/ldap/server/version.rb +11 -0
  29. data/vendor/ruby-ldapserver/test/core.schema +582 -0
  30. data/vendor/ruby-ldapserver/test/encoding_test.rb +279 -0
  31. data/vendor/ruby-ldapserver/test/filter_test.rb +107 -0
  32. data/vendor/ruby-ldapserver/test/match_test.rb +59 -0
  33. data/vendor/ruby-ldapserver/test/schema_test.rb +113 -0
  34. data/vendor/ruby-ldapserver/test/syntax_test.rb +40 -0
  35. data/vendor/ruby-ldapserver/test/test_helper.rb +2 -0
  36. data/vendor/ruby-ldapserver/test/util_test.rb +51 -0
  37. metadata +130 -0
@@ -0,0 +1,40 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+ require 'ldap/server/syntax'
3
+
4
+ class SyntaxTest < Test::Unit::TestCase
5
+
6
+ def test_integer
7
+ s = LDAP::Server::Syntax.find("1.3.6.1.4.1.1466.115.121.1.27")
8
+ assert_equal(LDAP::Server::Syntax, s.class)
9
+ assert_equal("Integer", s.desc)
10
+ assert_equal("( 1.3.6.1.4.1.1466.115.121.1.27 DESC 'Integer' )", s.to_def)
11
+ assert(!s.nhr)
12
+ assert(s.match("123"))
13
+ assert(!s.match("12A"))
14
+ assert_equal(123, s.value_from_s("123"))
15
+ assert_equal("456", s.value_to_s(456))
16
+ assert_equal("789", s.value_to_s("789"))
17
+ end
18
+
19
+ def test_unknown
20
+ s = LDAP::Server::Syntax.find("1.4.7.1")
21
+ assert_equal(LDAP::Server::Syntax, s.class)
22
+ assert_equal("1.4.7.1", s.oid)
23
+ assert_equal("1.4.7.1", s.to_s)
24
+ assert_equal("( 1.4.7.1 )", s.to_def)
25
+ assert_equal("false", s.value_to_s(false)) # generic value_to_s
26
+ assert_equal("true", s.value_from_s("true")) # generic value_from_s
27
+ assert(s.match("123")) # match anything
28
+ end
29
+
30
+ def test_nil
31
+ s = LDAP::Server::Syntax.find(nil)
32
+ assert_equal(nil, s)
33
+ end
34
+
35
+ def test_from_def
36
+ s = LDAP::Server::Syntax.from_def("( 1.2.3 DESC 'foobar' )")
37
+ assert_equal("1.2.3", s.oid)
38
+ assert_equal("foobar", s.desc)
39
+ end
40
+ end
@@ -0,0 +1,2 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ require 'test/unit'
@@ -0,0 +1,51 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+ require 'ldap/server/util'
3
+
4
+ class TestLdapUtil < Test::Unit::TestCase
5
+ def test_split_dn
6
+ # examples from RFC 2253
7
+ assert_equal(
8
+ [{"cn"=>"Steve Kille"},{"o"=>"Isode Limited"},{"c"=>"GB"}],
9
+ LDAP::Server::Operation.split_dn("CN=Steve Kille , O=Isode Limited;C=GB")
10
+ )
11
+ assert_equal(
12
+ [{"ou"=>"Sales","cn"=>"J. Smith"},{"o"=>"Widget Inc."},{"c"=>"US"}],
13
+ LDAP::Server::Operation.split_dn("OU=Sales+CN=J. Smith,O=Widget Inc.,C=US")
14
+ )
15
+ assert_equal(
16
+ [{"cn"=>"L. Eagle"},{"o"=>"Sue, Grabbit and Runn"},{"c"=>"GB"}],
17
+ LDAP::Server::Operation.split_dn("CN=L. Eagle,O=Sue\\, Grabbit and Runn,C=GB")
18
+ )
19
+ assert_equal(
20
+ [{"cn"=>"Before\rAfter"},{"o"=>"Test"},{"c"=>"GB"}],
21
+ LDAP::Server::Operation.split_dn("CN=Before\\0DAfter,O=Test,C=GB")
22
+ )
23
+ res = LDAP::Server::Operation.split_dn("SN=Lu\\C4\\8Di\\C4\\87")
24
+ assert_equal([{"sn"=>"Lu\xc4\x8di\xc4\x87"}], res)
25
+
26
+ # Just for fun, let's try parsing it as UTF8
27
+ r = res[0]["sn"].scan(/./u)
28
+ assert_equal(["L", "u", "\xc4\x8d", "i", "\xc4\x87"], r)
29
+ end
30
+
31
+ def test_join_dn
32
+ # examples from RFC 2253
33
+ assert_equal(
34
+ "cn=Steve Kille,o=Isode Limited,c=GB",
35
+ LDAP::Server::Operation.join_dn([{"cn"=>"Steve Kille"},{"o"=>"Isode Limited"},{"c"=>"GB"}])
36
+ )
37
+ # These are equivalent
38
+ d1 = "ou=Sales+cn=J. Smith,o=Widget Inc.,c=US"
39
+ d2 = "cn=J. Smith+ou=Sales,o=Widget Inc.,c=US"
40
+ assert_equal(d1,
41
+ LDAP::Server::Operation.join_dn([[["ou","Sales"],["cn","J. Smith"]],[["o","Widget Inc."]],["c","US"]])
42
+ )
43
+ r = LDAP::Server::Operation.join_dn([{"ou"=>"Sales","cn"=>"J. Smith"},{"o"=>"Widget Inc."},{"c"=>"US"}])
44
+ assert(r == d1 || r == d2, "got #{r.inspect}, expected #{d1.inspect} or #{d2.inspect}")
45
+ assert_equal(
46
+ "cn=L. Eagle,o=Sue\\, Grabbit and Runn,c=GB",
47
+ LDAP::Server::Operation.join_dn([{"cn"=>"L. Eagle"},{"o"=>"Sue, Grabbit and Runn"},{"c"=>"GB"}])
48
+ )
49
+ end
50
+ end
51
+
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fakeldap
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 0
10
+ version: 0.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Aanand Prasad
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-07-22 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: net-ldap
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :development
48
+ version_requirements: *id002
49
+ description:
50
+ email:
51
+ - aanand.prasad@gmail.com
52
+ executables: []
53
+
54
+ extensions: []
55
+
56
+ extra_rdoc_files: []
57
+
58
+ files:
59
+ - lib/fakeldap/version.rb
60
+ - lib/fakeldap.rb
61
+ - vendor/ruby-ldapserver/ChangeLog
62
+ - vendor/ruby-ldapserver/COPYING
63
+ - vendor/ruby-ldapserver/examples/mkcert.rb
64
+ - vendor/ruby-ldapserver/examples/rbslapd1.rb
65
+ - vendor/ruby-ldapserver/examples/rbslapd2.rb
66
+ - vendor/ruby-ldapserver/examples/rbslapd3.rb
67
+ - vendor/ruby-ldapserver/examples/README
68
+ - vendor/ruby-ldapserver/examples/speedtest.rb
69
+ - vendor/ruby-ldapserver/lib/ldap/server/connection.rb
70
+ - vendor/ruby-ldapserver/lib/ldap/server/filter.rb
71
+ - vendor/ruby-ldapserver/lib/ldap/server/match.rb
72
+ - vendor/ruby-ldapserver/lib/ldap/server/operation.rb
73
+ - vendor/ruby-ldapserver/lib/ldap/server/preforkserver.rb
74
+ - vendor/ruby-ldapserver/lib/ldap/server/result.rb
75
+ - vendor/ruby-ldapserver/lib/ldap/server/schema.rb
76
+ - vendor/ruby-ldapserver/lib/ldap/server/server.rb
77
+ - vendor/ruby-ldapserver/lib/ldap/server/syntax.rb
78
+ - vendor/ruby-ldapserver/lib/ldap/server/tcpserver.rb
79
+ - vendor/ruby-ldapserver/lib/ldap/server/util.rb
80
+ - vendor/ruby-ldapserver/lib/ldap/server/version.rb
81
+ - vendor/ruby-ldapserver/lib/ldap/server.rb
82
+ - vendor/ruby-ldapserver/Manifest.txt
83
+ - vendor/ruby-ldapserver/Rakefile
84
+ - vendor/ruby-ldapserver/README
85
+ - vendor/ruby-ldapserver/test/core.schema
86
+ - vendor/ruby-ldapserver/test/encoding_test.rb
87
+ - vendor/ruby-ldapserver/test/filter_test.rb
88
+ - vendor/ruby-ldapserver/test/match_test.rb
89
+ - vendor/ruby-ldapserver/test/schema_test.rb
90
+ - vendor/ruby-ldapserver/test/syntax_test.rb
91
+ - vendor/ruby-ldapserver/test/test_helper.rb
92
+ - vendor/ruby-ldapserver/test/util_test.rb
93
+ - LICENSE
94
+ - README.md
95
+ has_rdoc: true
96
+ homepage: http://github.com/aanand/fakeldap
97
+ licenses: []
98
+
99
+ post_install_message:
100
+ rdoc_options: []
101
+
102
+ require_paths:
103
+ - lib
104
+ required_ruby_version: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ hash: 3
110
+ segments:
111
+ - 0
112
+ version: "0"
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ hash: 3
119
+ segments:
120
+ - 0
121
+ version: "0"
122
+ requirements: []
123
+
124
+ rubyforge_project:
125
+ rubygems_version: 1.3.7
126
+ signing_key:
127
+ specification_version: 3
128
+ summary: A fake LDAP server for use in testing
129
+ test_files: []
130
+