activeldap 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +10 -0
- data/README +3 -2
- data/data/locale/en/LC_MESSAGES/active-ldap.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/active-ldap.mo +0 -0
- data/examples/al-admin/po/en/al-admin.po +1 -1
- data/examples/al-admin/po/ja/al-admin.po +1 -1
- data/examples/al-admin/po/nl/al-admin.po +1 -1
- data/examples/al-admin/vendor/plugins/exception_notification/lib/exception_notifier.rb +7 -8
- data/examples/al-admin/vendor/plugins/exception_notification/lib/exception_notifier_helper.rb +2 -1
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_environment.rhtml +1 -1
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_request.rhtml +2 -1
- data/lib/active_ldap.rb +9 -3
- data/lib/active_ldap/action_controller/ldap_benchmarking.rb +36 -0
- data/lib/active_ldap/adapter/jndi.rb +1 -1
- data/lib/active_ldap/adapter/jndi_connection.rb +2 -1
- data/lib/active_ldap/association/belongs_to_many.rb +10 -2
- data/lib/active_ldap/association/collection.rb +10 -0
- data/lib/active_ldap/association/has_many_utils.rb +13 -9
- data/lib/active_ldap/association/has_many_wrap.rb +10 -2
- data/lib/active_ldap/associations.rb +3 -3
- data/lib/active_ldap/base.rb +95 -32
- data/lib/active_ldap/connection.rb +1 -1
- data/lib/active_ldap/distinguished_name.rb +3 -0
- data/lib/active_ldap/entry_attribute.rb +2 -2
- data/lib/active_ldap/ldif.rb +2 -2
- data/lib/active_ldap/operations.rb +7 -3
- data/lib/active_ldap/user_password.rb +0 -1
- data/lib/active_ldap/validations.rb +2 -0
- data/po/en/active-ldap.po +1 -1
- data/po/ja/active-ldap.po +1 -1
- data/rails/plugin/active_ldap/init.rb +3 -34
- data/test-unit/History.txt +32 -0
- data/test-unit/Manifest.txt +70 -0
- data/test-unit/README.txt +32 -0
- data/test-unit/Rakefile +22 -0
- data/test-unit/bin/testrb +5 -0
- data/test-unit/lib/test/unit.rb +280 -0
- data/test-unit/lib/test/unit/assertionfailederror.rb +14 -0
- data/test-unit/lib/test/unit/assertions.rb +722 -0
- data/test-unit/lib/test/unit/attribute.rb +125 -0
- data/test-unit/lib/test/unit/autorunner.rb +250 -0
- data/test-unit/lib/test/unit/collector.rb +43 -0
- data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
- data/test-unit/lib/test/unit/collector/dir.rb +108 -0
- data/test-unit/lib/test/unit/collector/load.rb +135 -0
- data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
- data/test-unit/lib/test/unit/color.rb +61 -0
- data/test-unit/lib/test/unit/diff.rb +524 -0
- data/test-unit/lib/test/unit/error.rb +124 -0
- data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
- data/test-unit/lib/test/unit/failure.rb +110 -0
- data/test-unit/lib/test/unit/fixture.rb +185 -0
- data/test-unit/lib/test/unit/notification.rb +116 -0
- data/test-unit/lib/test/unit/omission.rb +129 -0
- data/test-unit/lib/test/unit/pending.rb +130 -0
- data/test-unit/lib/test/unit/priority.rb +146 -0
- data/test-unit/lib/test/unit/runner/console.rb +46 -0
- data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
- data/test-unit/lib/test/unit/testcase.rb +174 -0
- data/test-unit/lib/test/unit/testresult.rb +89 -0
- data/test-unit/lib/test/unit/testsuite.rb +110 -0
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +195 -0
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +49 -0
- data/test-unit/lib/test/unit/ui/testrunner.rb +20 -0
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/test-unit/lib/test/unit/util/backtracefilter.rb +41 -0
- data/test-unit/lib/test/unit/util/observable.rb +90 -0
- data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
- data/test-unit/lib/test/unit/version.rb +7 -0
- data/test-unit/sample/adder.rb +13 -0
- data/test-unit/sample/subtracter.rb +12 -0
- data/test-unit/sample/tc_adder.rb +18 -0
- data/test-unit/sample/tc_subtracter.rb +18 -0
- data/test-unit/sample/ts_examples.rb +7 -0
- data/test-unit/test/collector/test_descendant.rb +135 -0
- data/test-unit/test/collector/test_dir.rb +406 -0
- data/test-unit/test/collector/test_load.rb +333 -0
- data/test-unit/test/collector/test_objectspace.rb +98 -0
- data/test-unit/test/run-test.rb +13 -0
- data/test-unit/test/test_assertions.rb +693 -0
- data/test-unit/test/test_attribute.rb +86 -0
- data/{test-unit-ext → test-unit}/test/test_color.rb +3 -5
- data/{test-unit-ext → test-unit}/test/test_diff.rb +18 -16
- data/test-unit/test/test_emacs_runner.rb +60 -0
- data/test-unit/test/test_error.rb +26 -0
- data/test-unit/test/test_failure.rb +33 -0
- data/test-unit/test/test_fixture.rb +275 -0
- data/{test-unit-ext → test-unit}/test/test_notification.rb +7 -6
- data/test-unit/test/test_omission.rb +81 -0
- data/{test-unit-ext → test-unit}/test/test_pending.rb +15 -15
- data/{test-unit-ext → test-unit}/test/test_priority.rb +4 -3
- data/test-unit/test/test_testcase.rb +411 -0
- data/test-unit/test/test_testresult.rb +113 -0
- data/test-unit/test/test_testsuite.rb +129 -0
- data/test-unit/test/testunit_test_util.rb +12 -0
- data/test-unit/test/ui/test_testrunmediator.rb +20 -0
- data/test-unit/test/util/test_backtracefilter.rb +41 -0
- data/test-unit/test/util/test_observable.rb +102 -0
- data/test-unit/test/util/test_procwrapper.rb +36 -0
- data/test/al-test-utils.rb +4 -4
- data/test/command.rb +1 -1
- data/test/run-test.rb +5 -4
- data/test/test_associations.rb +143 -9
- data/test/test_base.rb +25 -1
- data/test/test_dn.rb +2 -0
- data/test/test_find.rb +8 -1
- data/test/test_ldif.rb +51 -114
- data/test/test_reflection.rb +4 -8
- data/test/test_usermod-lang-add.rb +2 -1
- data/test/test_validation.rb +4 -3
- metadata +76 -31
- data/test-unit-ext/NEWS.en +0 -28
- data/test-unit-ext/NEWS.ja +0 -28
- data/test-unit-ext/README.en +0 -247
- data/test-unit-ext/README.ja +0 -246
- data/test-unit-ext/Rakefile +0 -111
- data/test-unit-ext/lib/test-unit-ext.rb +0 -16
- data/test-unit-ext/lib/test-unit-ext/always-show-result.rb +0 -28
- data/test-unit-ext/lib/test-unit-ext/assertions.rb +0 -40
- data/test-unit-ext/lib/test-unit-ext/attributes.rb +0 -129
- data/test-unit-ext/lib/test-unit-ext/backtrace-filter.rb +0 -17
- data/test-unit-ext/lib/test-unit-ext/color.rb +0 -59
- data/test-unit-ext/lib/test-unit-ext/colorized-runner.rb +0 -111
- data/test-unit-ext/lib/test-unit-ext/diff.rb +0 -516
- data/test-unit-ext/lib/test-unit-ext/long-display-for-emacs.rb +0 -25
- data/test-unit-ext/lib/test-unit-ext/notification.rb +0 -79
- data/test-unit-ext/lib/test-unit-ext/omission.rb +0 -96
- data/test-unit-ext/lib/test-unit-ext/pending.rb +0 -97
- data/test-unit-ext/lib/test-unit-ext/priority.rb +0 -158
- data/test-unit-ext/lib/test-unit-ext/version.rb +0 -3
- data/test-unit-ext/lib/test-unit-ext/xml-report.rb +0 -224
- data/test-unit-ext/test/run-test.rb +0 -14
- data/test-unit-ext/test/test_attributes.rb +0 -139
- data/test-unit-ext/test/test_omission.rb +0 -64
- data/test-unit-ext/test/test_xml_report.rb +0 -161
data/test/al-test-utils.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'test/unit'
|
2
|
-
require 'test-unit-ext'
|
3
2
|
|
4
3
|
require 'erb'
|
5
4
|
require 'yaml'
|
@@ -290,9 +289,10 @@ module AlTestUtils
|
|
290
289
|
yield(uid)
|
291
290
|
ensure
|
292
291
|
if @user_class.exists?(uid)
|
293
|
-
|
294
|
-
|
295
|
-
|
292
|
+
@user_class.search(:value => uid) do |dn, attribute|
|
293
|
+
@user_class.remove_connection(dn)
|
294
|
+
@user_class.delete(dn)
|
295
|
+
end
|
296
296
|
end
|
297
297
|
end
|
298
298
|
|
data/test/command.rb
CHANGED
@@ -32,7 +32,7 @@ module Command
|
|
32
32
|
if args.any? {|x| x.nil?}
|
33
33
|
raise ArgumentError, "args has nil: #{args.inspect}"
|
34
34
|
end
|
35
|
-
return java_run(cmd, *args, &block)
|
35
|
+
return java_run(cmd, *args, &block) if Object.respond_to?(:java)
|
36
36
|
in_r, in_w = IO.pipe
|
37
37
|
out_r, out_w = IO.pipe
|
38
38
|
pid = exit_status = nil
|
data/test/run-test.rb
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
$VERBOSE = true
|
4
|
+
|
3
5
|
$KCODE = 'u'
|
4
6
|
|
5
7
|
require 'yaml'
|
6
|
-
require "test/unit"
|
7
8
|
|
8
9
|
base_dir = File.expand_path(File.dirname(__FILE__))
|
9
10
|
top_dir = File.expand_path(File.join(base_dir, ".."))
|
10
11
|
$LOAD_PATH.unshift(File.join(top_dir, "lib"))
|
11
12
|
$LOAD_PATH.unshift(File.join(top_dir, "test"))
|
12
13
|
|
13
|
-
$LOAD_PATH.unshift(File.join(top_dir, "test-unit
|
14
|
-
require
|
15
|
-
|
14
|
+
$LOAD_PATH.unshift(File.join(top_dir, "test-unit", "lib"))
|
15
|
+
require "test/unit"
|
16
|
+
ARGV.unshift("--priority-mode")
|
16
17
|
|
17
18
|
test_file = "test/test_*.rb"
|
18
19
|
Dir.glob(test_file) do |file|
|
data/test/test_associations.rb
CHANGED
@@ -4,20 +4,117 @@ class TestAssociations < Test::Unit::TestCase
|
|
4
4
|
include AlTestUtils
|
5
5
|
|
6
6
|
priority :must
|
7
|
+
def test_has_many_wrap_with_dn_value
|
8
|
+
@user_class.has_many :references, :wrap => "seeAlso", :primary_key => "dn"
|
9
|
+
@user_class.set_associated_class(:references, @group_class)
|
10
|
+
@group_class.belongs_to :related_users, :many => "seeAlso",
|
11
|
+
:foreign_key => "dn"
|
12
|
+
@group_class.set_associated_class(:related_users, @user_class)
|
13
|
+
make_temporary_user do |user,|
|
14
|
+
make_temporary_group do |group1|
|
15
|
+
make_temporary_group do |group2|
|
16
|
+
make_temporary_group do |group3|
|
17
|
+
entries = [user, group1, group2, group3]
|
18
|
+
|
19
|
+
user.references << group1
|
20
|
+
user, group1, group2, group3 = reload_entries(*entries)
|
21
|
+
assert_references([[group1]], [user])
|
22
|
+
assert_related_users([user], group1)
|
23
|
+
assert_related_users([], group2)
|
24
|
+
assert_related_users([], group3)
|
25
|
+
|
26
|
+
user.references = [group2, group3]
|
27
|
+
user, group1, group2, group3 = reload_entries(*entries)
|
28
|
+
assert_references([[group2, group3]], [user])
|
29
|
+
assert_related_users([], group1)
|
30
|
+
assert_related_users([user], group2)
|
31
|
+
assert_related_users([user], group3)
|
32
|
+
|
33
|
+
user.references.delete(group2)
|
34
|
+
user, group1, group2, group3 = reload_entries(*entries)
|
35
|
+
assert_references([[group3]], [user])
|
36
|
+
assert_related_users([], group1)
|
37
|
+
assert_related_users([], group2)
|
38
|
+
assert_related_users([user], group3)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
7
44
|
|
8
45
|
priority :normal
|
46
|
+
def test_belongs_to_many_with_dn_value
|
47
|
+
@user_class.has_many :references, :wrap => "seeAlso", :primary_key => "dn"
|
48
|
+
@user_class.set_associated_class(:references, @group_class)
|
49
|
+
@group_class.belongs_to :related_users, :many => "seeAlso",
|
50
|
+
:foreign_key => "dn"
|
51
|
+
@group_class.set_associated_class(:related_users, @user_class)
|
52
|
+
make_temporary_group do |group|
|
53
|
+
make_temporary_user do |user1,|
|
54
|
+
make_temporary_user do |user2,|
|
55
|
+
make_temporary_user do |user3,|
|
56
|
+
entries = [group, user1, user2, user3]
|
57
|
+
|
58
|
+
group.related_users = [user1, user2]
|
59
|
+
group, user1, user2, user3 = reload_entries(*entries)
|
60
|
+
assert_references([[group], [group], []],
|
61
|
+
[user1, user2, user3])
|
62
|
+
assert_related_users([user1, user2], group)
|
63
|
+
|
64
|
+
group.related_users << user3
|
65
|
+
group, user1, user2, user3 = reload_entries(*entries)
|
66
|
+
assert_references([[group], [group], [group]],
|
67
|
+
[user1, user2, user3])
|
68
|
+
assert_related_users([user1, user2, user3], group)
|
69
|
+
|
70
|
+
group.related_users.delete(user1)
|
71
|
+
group, user1, user2, user3 = reload_entries(*entries)
|
72
|
+
assert_references([[], [group], [group]],
|
73
|
+
[user1, user2, user3])
|
74
|
+
assert_related_users([user2, user3], group)
|
75
|
+
|
76
|
+
group.related_users = []
|
77
|
+
group, user1, user2, user3 = reload_entries(*entries)
|
78
|
+
assert_references([[], [], []],
|
79
|
+
[user1, user2, user3])
|
80
|
+
assert_related_users([], group)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
9
87
|
def test_belongs_to_many_with_dn_key
|
10
|
-
@user_class.belongs_to :
|
11
|
-
@user_class.set_associated_class(:
|
12
|
-
@group_class.has_many :
|
13
|
-
@group_class.set_associated_class(:
|
88
|
+
@user_class.belongs_to :dn_groups, :many => "memberUid", :foreign_key => "dn"
|
89
|
+
@user_class.set_associated_class(:dn_groups, @group_class)
|
90
|
+
@group_class.has_many :dn_members, :wrap => "memberUid", :primary_key => "dn"
|
91
|
+
@group_class.set_associated_class(:dn_members, @user_class)
|
14
92
|
make_temporary_group do |group|
|
15
93
|
make_temporary_user do |user1,|
|
16
94
|
make_temporary_user do |user2,|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
95
|
+
make_temporary_user do |user3,|
|
96
|
+
entries = [group, user1, user2, user3]
|
97
|
+
|
98
|
+
user1.dn_groups << group
|
99
|
+
group, user1, user2, user3 = reload_entries(*entries)
|
100
|
+
assert_dn_groups([[group], [], []], [user1, user2, user3])
|
101
|
+
assert_dn_members([user1], group)
|
102
|
+
|
103
|
+
user2.dn_groups = [group]
|
104
|
+
group, user1, user2, user3 = reload_entries(*entries)
|
105
|
+
assert_dn_groups([[group], [group], []], [user1, user2, user3])
|
106
|
+
assert_dn_members([user1, user2], group)
|
107
|
+
|
108
|
+
user1.dn_groups = []
|
109
|
+
group, user1, user2, user3 = reload_entries(*entries)
|
110
|
+
assert_dn_groups([[], [group], []], [user1, user2, user3])
|
111
|
+
assert_dn_members([user2], group)
|
112
|
+
|
113
|
+
user2.dn_groups.delete(group)
|
114
|
+
group, user1, user2, user3 = reload_entries(*entries)
|
115
|
+
assert_dn_groups([[], [], []], [user1, user2, user3])
|
116
|
+
assert_dn_members([], group)
|
117
|
+
end
|
21
118
|
end
|
22
119
|
end
|
23
120
|
end
|
@@ -44,7 +141,6 @@ class TestAssociations < Test::Unit::TestCase
|
|
44
141
|
end
|
45
142
|
end
|
46
143
|
|
47
|
-
priority :normal
|
48
144
|
def test_belongs_to_before_save
|
49
145
|
make_temporary_group do |group1|
|
50
146
|
make_temporary_group do |group2|
|
@@ -350,4 +446,42 @@ class TestAssociations < Test::Unit::TestCase
|
|
350
446
|
end
|
351
447
|
end
|
352
448
|
end
|
449
|
+
|
450
|
+
private
|
451
|
+
def reload_entries(*entries)
|
452
|
+
entries.collect do |entry|
|
453
|
+
entry.class.find(entry[entry.dn_attribute])
|
454
|
+
end
|
455
|
+
end
|
456
|
+
|
457
|
+
def assert_groups_relation(expected_groups_values, entries, relation_name)
|
458
|
+
expected_groups_values = expected_groups_values.collect do |groups|
|
459
|
+
groups.collect(&:cn).sort
|
460
|
+
end
|
461
|
+
actual_groups_values = entries.collect do |entry|
|
462
|
+
entry.send(relation_name).collect(&:cn).sort
|
463
|
+
end
|
464
|
+
assert_equal(expected_groups_values, actual_groups_values)
|
465
|
+
end
|
466
|
+
|
467
|
+
def assert_users_relation(expected_users, group, relation_name)
|
468
|
+
assert_equal(expected_users.collect(&:cn).sort,
|
469
|
+
group.send(relation_name).collect(&:cn).sort)
|
470
|
+
end
|
471
|
+
|
472
|
+
def assert_references(expected_groups_values, users)
|
473
|
+
assert_groups_relation(expected_groups_values, users, :references)
|
474
|
+
end
|
475
|
+
|
476
|
+
def assert_related_users(expected_users, group)
|
477
|
+
assert_users_relation(expected_users, group, :related_users)
|
478
|
+
end
|
479
|
+
|
480
|
+
def assert_dn_groups(expected_groups_values, users)
|
481
|
+
assert_groups_relation(expected_groups_values, users, :dn_groups)
|
482
|
+
end
|
483
|
+
|
484
|
+
def assert_dn_members(expected_users, group)
|
485
|
+
assert_users_relation(expected_users, group, :dn_members)
|
486
|
+
end
|
353
487
|
end
|
data/test/test_base.rb
CHANGED
@@ -6,6 +6,17 @@ class TestBase < Test::Unit::TestCase
|
|
6
6
|
include AlTestUtils
|
7
7
|
|
8
8
|
priority :must
|
9
|
+
def test_to_ldif
|
10
|
+
make_temporary_group do |group,|
|
11
|
+
assert_to_ldif(group)
|
12
|
+
|
13
|
+
group.gidNumber += 1
|
14
|
+
group.description = ["Description", {"en" => "Description(en)"}]
|
15
|
+
assert_to_ldif(group)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
priority :normal
|
9
20
|
def test_save_with_changes
|
10
21
|
make_temporary_user do |user, password|
|
11
22
|
user.cn += "!!!"
|
@@ -19,7 +30,6 @@ class TestBase < Test::Unit::TestCase
|
|
19
30
|
end
|
20
31
|
end
|
21
32
|
|
22
|
-
priority :normal
|
23
33
|
def test_normalize_dn_attribute
|
24
34
|
make_ou("Ous")
|
25
35
|
ou_class = Class.new(ActiveLdap::Base)
|
@@ -595,6 +605,12 @@ EOX
|
|
595
605
|
end
|
596
606
|
end
|
597
607
|
|
608
|
+
def test_attribute_present_with_unknown_attribute
|
609
|
+
make_temporary_user do |user, password|
|
610
|
+
assert(!user.attribute_present?(:unknown_attribute))
|
611
|
+
end
|
612
|
+
end
|
613
|
+
|
598
614
|
def test_update_all
|
599
615
|
make_temporary_user do |user, password|
|
600
616
|
make_temporary_user do |user2, password|
|
@@ -656,4 +672,12 @@ EOX
|
|
656
672
|
yield
|
657
673
|
modify_called
|
658
674
|
end
|
675
|
+
|
676
|
+
def assert_to_ldif(entry)
|
677
|
+
records = ActiveLdap::LDIF.parse(entry.to_ldif).records
|
678
|
+
parsed_entries = records.collect do |record|
|
679
|
+
entry.class.send(:instantiate, [record.dn, record.attributes])
|
680
|
+
end
|
681
|
+
assert_equal([entry], parsed_entries)
|
682
|
+
end
|
659
683
|
end
|
data/test/test_dn.rb
CHANGED
data/test/test_find.rb
CHANGED
@@ -4,6 +4,14 @@ class TestFind < Test::Unit::TestCase
|
|
4
4
|
include AlTestUtils
|
5
5
|
|
6
6
|
priority :must
|
7
|
+
def test_find_with_dn
|
8
|
+
make_temporary_user do |user,|
|
9
|
+
assert_equal(user.dn, @user_class.find(user.dn).dn)
|
10
|
+
assert_equal(user.dn, @user_class.find(ActiveLdap::DN.parse(user.dn)).dn)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
priority :normal
|
7
15
|
def test_find_with_special_value_prefix
|
8
16
|
# \2C == ','
|
9
17
|
make_ou("a\\2Cb,ou=Users")
|
@@ -31,7 +39,6 @@ class TestFind < Test::Unit::TestCase
|
|
31
39
|
end
|
32
40
|
end
|
33
41
|
|
34
|
-
priority :normal
|
35
42
|
def test_find_with_sort_by_in_ldap_mapping
|
36
43
|
@user_class.ldap_mapping(:dn_attribute => @user_class.dn_attribute,
|
37
44
|
:prefix => @user_class.prefix,
|
data/test/test_ldif.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
1
3
|
require 'al-test-utils'
|
2
4
|
|
3
5
|
class TestLDIF < Test::Unit::TestCase
|
@@ -560,6 +562,55 @@ replace: postaladdress
|
|
560
562
|
-
|
561
563
|
delete: description
|
562
564
|
-
|
565
|
+
EOL
|
566
|
+
|
567
|
+
assert_ldif_to_s(<<-EOL, ldif_source)
|
568
|
+
version: 1
|
569
|
+
dn: cn=Fiona Jensen,ou=Marketing,dc=airius,dc=com
|
570
|
+
changetype: add
|
571
|
+
cn: Fiona Jensen
|
572
|
+
objectclass: organizationalPerson
|
573
|
+
objectclass: person
|
574
|
+
objectclass: top
|
575
|
+
sn: Jensen
|
576
|
+
telephonenumber: +1 408 555 1212
|
577
|
+
uid: fiona
|
578
|
+
|
579
|
+
dn: cn=Robert Jensen,ou=Marketing,dc=airius,dc=com
|
580
|
+
changetype: delete
|
581
|
+
|
582
|
+
dn: cn=Paul Jensen,ou=Product Development,dc=airius,dc=com
|
583
|
+
changetype: modrdn
|
584
|
+
newrdn: cn=Paula Jensen
|
585
|
+
deleteoldrdn: 1
|
586
|
+
|
587
|
+
dn: ou=PD Accountants,ou=Product Development,dc=airius,dc=com
|
588
|
+
changetype: modrdn
|
589
|
+
newrdn: ou=Product Development Accountants
|
590
|
+
deleteoldrdn: 0
|
591
|
+
newsuperior: ou=Accounting,dc=airius,dc=com
|
592
|
+
|
593
|
+
dn: cn=Paula Jensen,ou=Product Development,dc=airius,dc=com
|
594
|
+
changetype: modify
|
595
|
+
add: postaladdress
|
596
|
+
postaladdress: 123 Anystreet $ Sunnyvale, CA $ 94086
|
597
|
+
-
|
598
|
+
delete: description
|
599
|
+
-
|
600
|
+
replace: telephonenumber
|
601
|
+
telephonenumber: +1 408 555 1234
|
602
|
+
telephonenumber: +1 408 555 5678
|
603
|
+
-
|
604
|
+
delete: facsimiletelephonenumber
|
605
|
+
facsimiletelephonenumber: +1 408 555 9876
|
606
|
+
-
|
607
|
+
|
608
|
+
dn: cn=Ingrid Jensen,ou=Product Support,dc=airius,dc=com
|
609
|
+
changetype: modify
|
610
|
+
replace: postaladdress
|
611
|
+
-
|
612
|
+
delete: description
|
613
|
+
-
|
563
614
|
EOL
|
564
615
|
|
565
616
|
change_attributes_add = {
|
@@ -665,120 +716,6 @@ EOL
|
|
665
716
|
actual)
|
666
717
|
end
|
667
718
|
|
668
|
-
def test_multi_change_type_records
|
669
|
-
ldif_source = <<-EOL
|
670
|
-
version: 1
|
671
|
-
# Add a new entry
|
672
|
-
dn: cn=Fiona Jensen, ou=Marketing, dc=airius, dc=com
|
673
|
-
changetype: add
|
674
|
-
objectclass: top
|
675
|
-
objectclass: person
|
676
|
-
objectclass: organizationalPerson
|
677
|
-
cn: Fiona Jensen
|
678
|
-
sn: Jensen
|
679
|
-
uid: fiona
|
680
|
-
telephonenumber: +1 408 555 1212
|
681
|
-
|
682
|
-
# Delete an existing entry
|
683
|
-
dn: cn=Robert Jensen, ou=Marketing, dc=airius, dc=com
|
684
|
-
changetype: delete
|
685
|
-
|
686
|
-
# Modify an entry's relative distinguished name
|
687
|
-
dn: cn=Paul Jensen, ou=Product Development, dc=airius, dc=com
|
688
|
-
changetype: modrdn
|
689
|
-
newrdn: cn=Paula Jensen
|
690
|
-
deleteoldrdn: 1
|
691
|
-
|
692
|
-
# Rename an entry and move all of its children to a new location in
|
693
|
-
# the directory tree (only implemented by LDAPv3 servers).
|
694
|
-
dn: ou=PD Accountants, ou=Product Development, dc=airius, dc=com
|
695
|
-
changetype: modrdn
|
696
|
-
newrdn: ou=Product Development Accountants
|
697
|
-
deleteoldrdn: 0
|
698
|
-
newsuperior: ou=Accounting, dc=airius, dc=com
|
699
|
-
|
700
|
-
# Modify an entry: add an additional value to the postaladdress
|
701
|
-
# attribute, completely delete the description attribute, replace
|
702
|
-
# the telephonenumber attribute with two values, and delete a specific
|
703
|
-
# value from the facsimiletelephonenumber attribute
|
704
|
-
dn: cn=Paula Jensen, ou=Product Development, dc=airius, dc=com
|
705
|
-
changetype: modify
|
706
|
-
add: postaladdress
|
707
|
-
postaladdress: 123 Anystreet $ Sunnyvale, CA $ 94086
|
708
|
-
-
|
709
|
-
delete: description
|
710
|
-
-
|
711
|
-
replace: telephonenumber
|
712
|
-
telephonenumber: +1 408 555 1234
|
713
|
-
telephonenumber: +1 408 555 5678
|
714
|
-
-
|
715
|
-
delete: facsimiletelephonenumber
|
716
|
-
facsimiletelephonenumber: +1 408 555 9876
|
717
|
-
-
|
718
|
-
|
719
|
-
# Modify an entry: replace the postaladdress attribute with an empty
|
720
|
-
# set of values (which will cause the attribute to be removed), and
|
721
|
-
# delete the entire description attribute. Note that the first will
|
722
|
-
# always succeed, while the second will only succeed if at least
|
723
|
-
# one value for the description attribute is present.
|
724
|
-
dn: cn=Ingrid Jensen, ou=Product Support, dc=airius, dc=com
|
725
|
-
changetype: modify
|
726
|
-
replace: postaladdress
|
727
|
-
-
|
728
|
-
delete: description
|
729
|
-
-
|
730
|
-
EOL
|
731
|
-
|
732
|
-
assert_ldif_to_s(<<-EOL, ldif_source)
|
733
|
-
version: 1
|
734
|
-
dn: cn=Fiona Jensen,ou=Marketing,dc=airius,dc=com
|
735
|
-
changetype: add
|
736
|
-
cn: Fiona Jensen
|
737
|
-
objectclass: organizationalPerson
|
738
|
-
objectclass: person
|
739
|
-
objectclass: top
|
740
|
-
sn: Jensen
|
741
|
-
telephonenumber: +1 408 555 1212
|
742
|
-
uid: fiona
|
743
|
-
|
744
|
-
dn: cn=Robert Jensen,ou=Marketing,dc=airius,dc=com
|
745
|
-
changetype: delete
|
746
|
-
|
747
|
-
dn: cn=Paul Jensen,ou=Product Development,dc=airius,dc=com
|
748
|
-
changetype: modrdn
|
749
|
-
newrdn: cn=Paula Jensen
|
750
|
-
deleteoldrdn: 1
|
751
|
-
|
752
|
-
dn: ou=PD Accountants,ou=Product Development,dc=airius,dc=com
|
753
|
-
changetype: modrdn
|
754
|
-
newrdn: ou=Product Development Accountants
|
755
|
-
deleteoldrdn: 0
|
756
|
-
newsuperior: ou=Accounting,dc=airius,dc=com
|
757
|
-
|
758
|
-
dn: cn=Paula Jensen,ou=Product Development,dc=airius,dc=com
|
759
|
-
changetype: modify
|
760
|
-
add: postaladdress
|
761
|
-
postaladdress: 123 Anystreet $ Sunnyvale, CA $ 94086
|
762
|
-
-
|
763
|
-
delete: description
|
764
|
-
-
|
765
|
-
replace: telephonenumber
|
766
|
-
telephonenumber: +1 408 555 1234
|
767
|
-
telephonenumber: +1 408 555 5678
|
768
|
-
-
|
769
|
-
delete: facsimiletelephonenumber
|
770
|
-
facsimiletelephonenumber: +1 408 555 9876
|
771
|
-
-
|
772
|
-
|
773
|
-
dn: cn=Ingrid Jensen,ou=Product Support,dc=airius,dc=com
|
774
|
-
changetype: modify
|
775
|
-
replace: postaladdress
|
776
|
-
-
|
777
|
-
delete: description
|
778
|
-
-
|
779
|
-
EOL
|
780
|
-
end
|
781
|
-
|
782
719
|
def test_modify_record
|
783
720
|
ldif_source = <<-EOL
|
784
721
|
version: 1
|