activeldap 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +11 -0
- data/README +6 -3
- data/Rakefile +6 -6
- data/examples/al-admin/config/environment.rb +3 -3
- data/examples/groupadd +1 -1
- data/examples/groupdel +1 -1
- data/examples/groupls +1 -1
- data/examples/groupmod +1 -1
- data/examples/lpasswd +1 -1
- data/examples/ouadd +1 -1
- data/examples/useradd +1 -1
- data/examples/useradd-binary +1 -1
- data/examples/userdel +1 -1
- data/examples/userls +1 -1
- data/examples/usermod +1 -1
- data/examples/usermod-binary-add +1 -1
- data/examples/usermod-binary-add-time +1 -1
- data/examples/usermod-binary-del +1 -1
- data/examples/usermod-lang-add +1 -1
- data/lib/active_ldap.rb +6 -6
- data/lib/active_ldap/adapter/base.rb +14 -1
- data/lib/active_ldap/adapter/jndi.rb +5 -1
- data/lib/active_ldap/adapter/net_ldap.rb +7 -1
- data/lib/active_ldap/association/belongs_to_many.rb +4 -0
- data/lib/active_ldap/association/has_many.rb +5 -5
- data/lib/active_ldap/association/has_many_utils.rb +5 -6
- data/lib/active_ldap/association/has_many_wrap.rb +13 -9
- data/lib/active_ldap/association/proxy.rb +5 -1
- data/lib/active_ldap/associations.rb +1 -1
- data/lib/active_ldap/attributes.rb +7 -3
- data/lib/active_ldap/base.rb +16 -2
- data/lib/active_ldap/distinguished_name.rb +3 -6
- data/lib/active_ldap/operations.rb +11 -8
- data/lib/active_ldap/timeout_stub.rb +1 -1
- data/lib/active_ldap/xml.rb +5 -2
- data/test-unit/History.txt +54 -0
- data/test-unit/Manifest.txt +3 -3
- data/test-unit/README.txt +4 -1
- data/test-unit/images/color-diff.png +0 -0
- data/test-unit/lib/test/unit.rb +23 -42
- data/test-unit/lib/test/unit/assertionfailederror.rb +11 -0
- data/test-unit/lib/test/unit/assertions.rb +77 -8
- data/test-unit/lib/test/unit/autorunner.rb +13 -2
- data/test-unit/lib/test/unit/collector/load.rb +2 -3
- data/test-unit/lib/test/unit/color-scheme.rb +13 -1
- data/test-unit/lib/test/unit/diff.rb +223 -37
- data/test-unit/lib/test/unit/failure.rb +27 -5
- data/test-unit/lib/test/unit/omission.rb +47 -3
- data/test-unit/lib/test/unit/testcase.rb +42 -0
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +189 -3
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +14 -0
- data/test-unit/lib/test/unit/ui/testrunner.rb +8 -0
- data/test-unit/lib/test/unit/version.rb +1 -1
- data/test-unit/sample/{tc_adder.rb → test_adder.rb} +3 -1
- data/test-unit/sample/{tc_subtracter.rb → test_subtracter.rb} +3 -1
- data/test-unit/sample/test_user.rb +1 -0
- data/test-unit/test/run-test.rb +2 -0
- data/test-unit/test/test-color-scheme.rb +7 -0
- data/test-unit/test/test-diff.rb +48 -7
- data/test-unit/test/test-omission.rb +1 -1
- data/test-unit/test/test-testcase.rb +27 -0
- data/test-unit/test/test_assertions.rb +43 -10
- data/test/al-test-utils.rb +15 -0
- data/test/test_associations.rb +46 -1
- data/test/test_attributes.rb +43 -20
- data/test/test_base.rb +60 -3
- metadata +12 -12
- data/test-unit/sample/ts_examples.rb +0 -7
data/test-unit/test/test-diff.rb
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
class TestUnitDiff < Test::Unit::TestCase
|
2
|
+
def test_binary_search_ranges
|
3
|
+
assert_found_binary_search_ranges(5, [1..2, 4..5, 7..9])
|
4
|
+
assert_not_found_binary_search_ranges(3, [1..2, 4..5, 7..9])
|
5
|
+
end
|
6
|
+
|
2
7
|
def test_to_indexes
|
3
8
|
assert_to_indexes({"abc def" => [0, 2], "abc" => [1]},
|
4
9
|
["abc def", "abc", "abc def"])
|
@@ -189,6 +194,21 @@ class TestUnitDiff < Test::Unit::TestCase
|
|
189
194
|
assert_ratio(0.80, "efg", "eg")
|
190
195
|
end
|
191
196
|
|
197
|
+
def test_1_length_readable_diff
|
198
|
+
differ = Test::Unit::Diff::ReadableDiffer.new(["0"], ["1"])
|
199
|
+
def differ.cut_off_ratio
|
200
|
+
0
|
201
|
+
end
|
202
|
+
def differ.default_ratio
|
203
|
+
0
|
204
|
+
end
|
205
|
+
assert_equal("- 0\n" +
|
206
|
+
"? ^\n" +
|
207
|
+
"+ 1\n" +
|
208
|
+
"? ^",
|
209
|
+
differ.diff.join("\n"))
|
210
|
+
end
|
211
|
+
|
192
212
|
def test_same_contents_readable_diff
|
193
213
|
assert_readable_diff(" aaa", ["aaa"], ["aaa"])
|
194
214
|
assert_readable_diff(" aaa\n" \
|
@@ -387,6 +407,18 @@ class TestUnitDiff < Test::Unit::TestCase
|
|
387
407
|
end
|
388
408
|
|
389
409
|
private
|
410
|
+
def assert_found_binary_search_ranges(numeric, ranges)
|
411
|
+
assert_true(Test::Unit::Diff::UTF8Line.send(:binary_search_ranges,
|
412
|
+
numeric,
|
413
|
+
ranges))
|
414
|
+
end
|
415
|
+
|
416
|
+
def assert_not_found_binary_search_ranges(numeric, ranges)
|
417
|
+
assert_false(Test::Unit::Diff::UTF8Line.send(:binary_search_ranges,
|
418
|
+
numeric,
|
419
|
+
ranges))
|
420
|
+
end
|
421
|
+
|
390
422
|
def assert_to_indexes(expected, to, &junk_predicate)
|
391
423
|
matcher = Test::Unit::Diff::SequenceMatcher.new([""], to, &junk_predicate)
|
392
424
|
assert_equal(expected, matcher.instance_variable_get("@to_indexes"))
|
@@ -451,21 +483,30 @@ class TestUnitDiff < Test::Unit::TestCase
|
|
451
483
|
from_start, from_end,
|
452
484
|
to_start, to_end)
|
453
485
|
differ = Test::Unit::Diff::ReadableDiffer.new(from, to)
|
454
|
-
|
455
|
-
|
456
|
-
|
486
|
+
result = []
|
487
|
+
differ.instance_variable_set("@result", result)
|
488
|
+
differ.send(:diff_lines,
|
489
|
+
from_start, from_end,
|
490
|
+
to_start, to_end)
|
491
|
+
assert_equal(expected, result)
|
457
492
|
end
|
458
493
|
|
459
494
|
def assert_diff_line(expected, from_line, to_line)
|
460
495
|
differ = Test::Unit::Diff::ReadableDiffer.new([""], [""])
|
461
|
-
|
496
|
+
result = []
|
497
|
+
differ.instance_variable_set("@result", result)
|
498
|
+
differ.send(:diff_line, from_line, to_line)
|
499
|
+
assert_equal(expected, result)
|
462
500
|
end
|
463
501
|
|
464
502
|
def assert_format_diff_point(expected, from_line, to_line, from_tags, to_tags)
|
465
503
|
differ = Test::Unit::Diff::ReadableDiffer.new([""], [""])
|
466
|
-
|
467
|
-
|
468
|
-
|
504
|
+
result = []
|
505
|
+
differ.instance_variable_set("@result", result)
|
506
|
+
differ.send(:format_diff_point,
|
507
|
+
from_line, to_line,
|
508
|
+
from_tags, to_tags)
|
509
|
+
assert_equal(expected, result)
|
469
510
|
end
|
470
511
|
|
471
512
|
def assert_interesting_line(expected, from, to, from_start, to_start)
|
@@ -68,7 +68,7 @@ class TestUnitOmission < Test::Unit::TestCase
|
|
68
68
|
|
69
69
|
def test_omit_with_condition_and_block
|
70
70
|
result = _run_test("test_omit_with_block_and_condition")
|
71
|
-
assert_equal("1 tests,
|
71
|
+
assert_equal("1 tests, 2 assertions, 0 failures, 0 errors, 0 pendings, " \
|
72
72
|
"1 omissions, 0 notifications",
|
73
73
|
result.to_s)
|
74
74
|
assert_fault_messages(["Should omit."], result.omissions)
|
@@ -490,6 +490,33 @@ module Test
|
|
490
490
|
end
|
491
491
|
end
|
492
492
|
|
493
|
+
def test_declarative_style
|
494
|
+
keep_test_order do
|
495
|
+
test_case = Class.new(Test::Unit::TestCase) do
|
496
|
+
test "declarative style test definition" do
|
497
|
+
end
|
498
|
+
|
499
|
+
test "include parenthesis" do
|
500
|
+
end
|
501
|
+
|
502
|
+
test "1 + 2 = 3" do
|
503
|
+
end
|
504
|
+
end
|
505
|
+
|
506
|
+
test_case.test_order = :defined
|
507
|
+
|
508
|
+
assert_equal(["test_declarative_style_test_definition",
|
509
|
+
"test_include_parenthesis",
|
510
|
+
"test_1_2_3"],
|
511
|
+
test_case.suite.tests.collect {|test| test.method_name})
|
512
|
+
|
513
|
+
assert_equal(["declarative style test definition",
|
514
|
+
"include parenthesis",
|
515
|
+
"1 + 2 = 3"],
|
516
|
+
test_case.suite.tests.collect {|test| test.description})
|
517
|
+
end
|
518
|
+
end
|
519
|
+
|
493
520
|
private
|
494
521
|
def check(message, passed)
|
495
522
|
add_assertion
|
@@ -248,32 +248,30 @@ EOM
|
|
248
248
|
|
249
249
|
def test_assert_equal_with_large_string
|
250
250
|
message = <<-EOM.chomp
|
251
|
-
<#{("a\n" + "x" *
|
251
|
+
<#{("a\n" + "x" * 997).inspect}> expected but was
|
252
252
|
<#{"x".inspect}>.
|
253
253
|
|
254
254
|
diff:
|
255
255
|
+ x
|
256
256
|
- a
|
257
|
-
- #{"x" *
|
257
|
+
- #{"x" * 997}
|
258
258
|
|
259
259
|
folded diff:
|
260
260
|
+ x
|
261
261
|
- a
|
262
|
-
|
263
|
-
- #{"x" *
|
264
|
-
- #{"x" * 78}
|
265
|
-
- #{"x" * 63}
|
262
|
+
#{(["- " + ("x" * 78)] * 12).join("\n")}
|
263
|
+
- #{"x" * 61}
|
266
264
|
EOM
|
267
265
|
check_fails(message) do
|
268
|
-
assert_equal("a\n" + "x" *
|
266
|
+
assert_equal("a\n" + "x" * 997, "x")
|
269
267
|
end
|
270
268
|
|
271
269
|
message = <<-EOM.chomp
|
272
|
-
<#{("a\n" + "x" *
|
270
|
+
<#{("a\n" + "x" * 998).inspect}> expected but was
|
273
271
|
<#{"x".inspect}>.
|
274
272
|
EOM
|
275
273
|
check_fails(message) do
|
276
|
-
assert_equal("a\n" + "x" *
|
274
|
+
assert_equal("a\n" + "x" * 998, "x")
|
277
275
|
end
|
278
276
|
end
|
279
277
|
|
@@ -1063,8 +1061,43 @@ EOM
|
|
1063
1061
|
end
|
1064
1062
|
end
|
1065
1063
|
|
1064
|
+
def test_assert_alias_method
|
1065
|
+
object = Object.new
|
1066
|
+
class << object
|
1067
|
+
def original_method
|
1068
|
+
end
|
1069
|
+
alias_method :alias_method, :original_method
|
1070
|
+
|
1071
|
+
def other
|
1072
|
+
end
|
1073
|
+
end
|
1074
|
+
|
1075
|
+
check_nothing_fails do
|
1076
|
+
assert_alias_method(object, :alias_method, :original_method)
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
check_nothing_fails do
|
1080
|
+
assert_alias_method(object, :original_method, :alias_method)
|
1081
|
+
end
|
1082
|
+
|
1083
|
+
check_fails("<#{object.method(:other).inspect}> is alias of\n" +
|
1084
|
+
"<#{object.method(:original_method).inspect}> expected") do
|
1085
|
+
assert_alias_method(object, :other, :original_method)
|
1086
|
+
end
|
1087
|
+
|
1088
|
+
check_fails("<#{object.inspect}>.nonexistent doesn't exist\n" +
|
1089
|
+
"(Class: <Object>)") do
|
1090
|
+
assert_alias_method(object, :nonexistent, :original_method)
|
1091
|
+
end
|
1092
|
+
|
1093
|
+
check_fails("<#{object.inspect}>.nonexistent doesn't exist\n" +
|
1094
|
+
"(Class: <Object>)") do
|
1095
|
+
assert_alias_method(object, :alias_method, :nonexistent)
|
1096
|
+
end
|
1097
|
+
end
|
1098
|
+
|
1066
1099
|
private
|
1067
|
-
def add_failure(message, location=caller)
|
1100
|
+
def add_failure(message, location=caller, options=nil)
|
1068
1101
|
unless @catch_assertions
|
1069
1102
|
super
|
1070
1103
|
end
|
data/test/al-test-utils.rb
CHANGED
@@ -182,6 +182,7 @@ module AlTestUtils
|
|
182
182
|
populate_user_class
|
183
183
|
populate_group_class
|
184
184
|
populate_associations
|
185
|
+
populate_get_text_fix
|
185
186
|
end
|
186
187
|
|
187
188
|
def populate_base
|
@@ -257,6 +258,18 @@ module AlTestUtils
|
|
257
258
|
@group_class.set_associated_class(:members, @user_class)
|
258
259
|
@group_class.set_associated_class(:primary_members, @user_class)
|
259
260
|
end
|
261
|
+
|
262
|
+
def populate_get_text_fix
|
263
|
+
return if ActiveLdap.get_text_supported?
|
264
|
+
|
265
|
+
def @user_class.name
|
266
|
+
"User"
|
267
|
+
end
|
268
|
+
|
269
|
+
def @group_class.name
|
270
|
+
"Group"
|
271
|
+
end
|
272
|
+
end
|
260
273
|
end
|
261
274
|
|
262
275
|
module TemporaryEntry
|
@@ -276,6 +289,7 @@ module AlTestUtils
|
|
276
289
|
uid_number = config[:uid_number] || default_uid
|
277
290
|
gid_number = config[:gid_number] || default_gid
|
278
291
|
home_directory = config[:home_directory] || "/nonexistent"
|
292
|
+
see_also = config[:see_also]
|
279
293
|
_wrap_assertion do
|
280
294
|
assert(!@user_class.exists?(uid))
|
281
295
|
assert_raise(ActiveLdap::EntryNotFound) do
|
@@ -289,6 +303,7 @@ module AlTestUtils
|
|
289
303
|
user.gid_number = gid_number
|
290
304
|
user.home_directory = home_directory
|
291
305
|
user.user_password = ActiveLdap::UserPassword.ssha(password)
|
306
|
+
user.see_also = see_also
|
292
307
|
unless config[:simple]
|
293
308
|
user.add_class('shadowAccount', 'inetOrgPerson',
|
294
309
|
'organizationalPerson')
|
data/test/test_associations.rb
CHANGED
@@ -4,6 +4,52 @@ class TestAssociations < Test::Unit::TestCase
|
|
4
4
|
include AlTestUtils
|
5
5
|
|
6
6
|
priority :must
|
7
|
+
def test_has_many_of_self
|
8
|
+
@user_class.has_many(:references,
|
9
|
+
:class_name => "User",
|
10
|
+
:primary_key => "dn",
|
11
|
+
:foreign_key => "seeAlso")
|
12
|
+
@user_class.set_associated_class(:references, @user_class)
|
13
|
+
make_temporary_user do |user1, password1|
|
14
|
+
make_temporary_user(:see_also => user1.dn.to_s) do |user2, password2|
|
15
|
+
make_temporary_user(:see_also => user2.dn.to_s) do |user3, password3|
|
16
|
+
make_temporary_user(:see_also => user2.dn.to_s) do |user4, password4|
|
17
|
+
make_temporary_user(:see_also => user1.dn.to_s) do |user5, password5|
|
18
|
+
user1_references = user1.references.collect {|r| r.dn.to_s}
|
19
|
+
user2_references = user2.references.collect {|r| r.dn.to_s}
|
20
|
+
user1_expected_references = [user2, user5].collect {|r| r.dn.to_s}
|
21
|
+
user2_expected_references = [user3, user4].collect {|r| r.dn.to_s}
|
22
|
+
assert_equal(user1_expected_references, user1_references)
|
23
|
+
assert_equal(user2_expected_references, user2_references)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
priority :normal
|
32
|
+
def test_belongs_to_add_with_string
|
33
|
+
make_temporary_user do |user,|
|
34
|
+
make_temporary_group do |group1|
|
35
|
+
make_temporary_group do |group2|
|
36
|
+
assert_equal([[], []],
|
37
|
+
[group1.members.collect(&:cn),
|
38
|
+
group2.members.collect(&:cn)])
|
39
|
+
|
40
|
+
user.groups = [group1.cn, group2.cn]
|
41
|
+
user.save!
|
42
|
+
|
43
|
+
group1.reload
|
44
|
+
group2.reload
|
45
|
+
assert_equal([[user.cn], [user.cn]],
|
46
|
+
[group1.members.collect(&:cn),
|
47
|
+
group2.members.collect(&:cn)])
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
7
53
|
def test_has_many_delete_required_attribute
|
8
54
|
make_temporary_group do |group|
|
9
55
|
make_temporary_user do |user,|
|
@@ -15,7 +61,6 @@ class TestAssociations < Test::Unit::TestCase
|
|
15
61
|
end
|
16
62
|
end
|
17
63
|
|
18
|
-
priority :normal
|
19
64
|
def test_to_xml
|
20
65
|
make_temporary_user do |user,|
|
21
66
|
make_temporary_group do |group1|
|
data/test/test_attributes.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
1
3
|
require 'al-test-utils'
|
2
4
|
|
3
5
|
class TestAttributes < Test::Unit::TestCase
|
@@ -32,29 +34,41 @@ class TestAttributes < Test::Unit::TestCase
|
|
32
34
|
end
|
33
35
|
|
34
36
|
def test_normalize_attribute
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
37
|
+
assert_normalize_attribute(["usercertificate", [{"binary" => []}]],
|
38
|
+
"userCertificate",
|
39
|
+
[])
|
40
|
+
assert_normalize_attribute(["usercertificate", [{"binary" => []}]],
|
41
|
+
"userCertificate",
|
42
|
+
nil)
|
43
|
+
assert_normalize_attribute(["usercertificate",
|
44
|
+
[{"binary" => "BINARY DATA"}]],
|
45
|
+
"userCertificate",
|
46
|
+
"BINARY DATA")
|
47
|
+
assert_normalize_attribute(["usercertificate",
|
48
|
+
[{"binary" => ["BINARY DATA"]}]],
|
49
|
+
"userCertificate",
|
50
|
+
{"binary" => ["BINARY DATA"]})
|
46
51
|
end
|
47
52
|
|
48
53
|
def test_unnormalize_attribute
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
assert_unnormalize_attribute({"sn" => ["Surname"]},
|
55
|
+
"sn",
|
56
|
+
["Surname"])
|
57
|
+
assert_unnormalize_attribute({"userCertificate;binary" => []},
|
58
|
+
"userCertificate",
|
59
|
+
[{"binary" => []}])
|
60
|
+
assert_unnormalize_attribute({"userCertificate;binary" => ["BINARY DATA"]},
|
61
|
+
"userCertificate",
|
62
|
+
[{"binary" => ["BINARY DATA"]}])
|
63
|
+
assert_unnormalize_attribute({
|
64
|
+
"sn" => ["Yamada"],
|
65
|
+
"sn;lang-ja" => ["山田"],
|
66
|
+
"sn;lang-ja;phonetic" => ["やまだ"]
|
67
|
+
},
|
68
|
+
"sn",
|
69
|
+
["Yamada",
|
70
|
+
{"lang-ja" => ["山田",
|
71
|
+
{"phonetic" => ["やまだ"]}]}])
|
58
72
|
end
|
59
73
|
|
60
74
|
def test_attr_protected
|
@@ -91,4 +105,13 @@ class TestAttributes < Test::Unit::TestCase
|
|
91
105
|
assert_nil(user.sn)
|
92
106
|
assert_equal("Common Name", user.cn)
|
93
107
|
end
|
108
|
+
|
109
|
+
private
|
110
|
+
def assert_normalize_attribute(expected, name, value)
|
111
|
+
assert_equal(expected, ActiveLdap::Base.normalize_attribute(name, value))
|
112
|
+
end
|
113
|
+
|
114
|
+
def assert_unnormalize_attribute(expected, name, value)
|
115
|
+
assert_equal(expected, ActiveLdap::Base.unnormalize_attribute(name, value))
|
116
|
+
end
|
94
117
|
end
|
data/test/test_base.rb
CHANGED
@@ -6,14 +6,65 @@ class TestBase < Test::Unit::TestCase
|
|
6
6
|
include AlTestUtils
|
7
7
|
|
8
8
|
priority :must
|
9
|
+
def test_modify_entry_with_attribute_with_nested_options
|
10
|
+
make_temporary_user(:simple => true) do |user,|
|
11
|
+
user.sn = ["Yamada",
|
12
|
+
{"lang-ja" => ["山田",
|
13
|
+
{"phonetic" => ["やまだ"]}]}]
|
14
|
+
assert_nothing_raised do
|
15
|
+
user.save!
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
priority :normal
|
21
|
+
def test_add_entry_with_attribute_with_nested_options
|
22
|
+
ensure_delete_user("temp-user") do |uid,|
|
23
|
+
user = @user_class.new
|
24
|
+
user.cn = uid
|
25
|
+
user.uid = uid
|
26
|
+
user.uid_number = 1000
|
27
|
+
user.gid_number = 1000
|
28
|
+
user.home_directory = "/home/#{uid}"
|
29
|
+
|
30
|
+
assert_not_predicate(user, :valid?)
|
31
|
+
user.sn = ["Yamada",
|
32
|
+
{"lang-ja" => ["山田",
|
33
|
+
{"phonetic" => ["やまだ"]}]}]
|
34
|
+
assert_predicate(user, :valid?)
|
35
|
+
assert_nothing_raised do
|
36
|
+
user.save!
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_not_rename_by_mass_update
|
42
|
+
make_temporary_user(:simple => true) do |user,|
|
43
|
+
original_id = user.id
|
44
|
+
assert_true(user.update_attributes(:id => "user2"))
|
45
|
+
assert_equal(original_id, user.id)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_attributes
|
50
|
+
make_temporary_group do |group|
|
51
|
+
assert_equal({
|
52
|
+
"cn" => group.cn,
|
53
|
+
"gidNumber" => group.gidNumber,
|
54
|
+
"objectClass" => group.classes,
|
55
|
+
},
|
56
|
+
group.attributes)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
9
60
|
def test_rename_with_superior
|
10
61
|
make_ou("sub,ou=users")
|
11
62
|
make_temporary_user(:simple => true) do |user,|
|
12
63
|
user.id = "user2,ou=sub,#{@user_class.base}"
|
13
|
-
|
64
|
+
case user.connection.class.to_s.demodulize
|
65
|
+
when "Jndi"
|
14
66
|
assert_true(user.save)
|
15
67
|
|
16
|
-
# the following codes aren't reached for now. :<
|
17
68
|
found_user = nil
|
18
69
|
assert_nothing_raised do
|
19
70
|
found_user = @user_class.find("user2")
|
@@ -21,6 +72,10 @@ class TestBase < Test::Unit::TestCase
|
|
21
72
|
base = @user_class.base
|
22
73
|
assert_equal("#{@user_class.dn_attribute}=user2,ou=sub,#{base}",
|
23
74
|
found_user.dn.to_s)
|
75
|
+
else
|
76
|
+
assert_raise(ActiveLdap::NotImplemented) do
|
77
|
+
user.save
|
78
|
+
end
|
24
79
|
end
|
25
80
|
end
|
26
81
|
end
|
@@ -43,7 +98,6 @@ class TestBase < Test::Unit::TestCase
|
|
43
98
|
end
|
44
99
|
end
|
45
100
|
|
46
|
-
priority :normal
|
47
101
|
def test_operational_attributes
|
48
102
|
make_temporary_group do |group|
|
49
103
|
dn, attributes = @group_class.search(:attributes => ["*"])[0]
|
@@ -310,17 +364,20 @@ class TestBase < Test::Unit::TestCase
|
|
310
364
|
mapping = {:classes => ["person"]}
|
311
365
|
person_class = Class.new(@user_class)
|
312
366
|
person_class.ldap_mapping(mapping)
|
367
|
+
person_class.prefix = nil
|
313
368
|
|
314
369
|
no_organizational_person_class = Class.new(@user_class)
|
315
370
|
no_organizational_person_mapping =
|
316
371
|
mapping.merge(:excluded_classes => ["organizationalPerson"])
|
317
372
|
no_organizational_person_class.ldap_mapping(no_organizational_person_mapping)
|
373
|
+
no_organizational_person_class.prefix = nil
|
318
374
|
|
319
375
|
no_simple_person_class = Class.new(@user_class)
|
320
376
|
no_simple_person_mapping =
|
321
377
|
mapping.merge(:excluded_classes => ['shadowAccount', 'inetOrgPerson',
|
322
378
|
"organizationalPerson"])
|
323
379
|
no_simple_person_class.ldap_mapping(no_simple_person_mapping)
|
380
|
+
no_simple_person_class.prefix = nil
|
324
381
|
|
325
382
|
make_temporary_user do |user1,|
|
326
383
|
make_temporary_user(:simple => true) do |user2,|
|