@@ -16,6 +16,29 @@ def setup
16
16
assert @ldap . add ( dn : @dn , attributes : attrs ) , @ldap . get_operation_result . inspect
17
17
end
18
18
assert @ldap . search ( base : @dn , scope : Net ::LDAP ::SearchScope_BaseObject )
19
+
20
+ @parent_dn = "uid=parent,ou=People,dc=example,dc=org"
21
+ parent_attrs = {
22
+ objectclass : %w( top inetOrgPerson organizationalPerson person ) ,
23
+ uid : "parent" ,
24
+ cn : "parent" ,
25
+ sn : "parent" ,
26
+ mail : "parent@rubyldap.com" ,
27
+ }
28
+ @child_dn = "uid=child,uid=parent,ou=People,dc=example,dc=org"
29
+ child_attrs = {
30
+ objectclass : %w( top inetOrgPerson organizationalPerson person ) ,
31
+ uid : "child" ,
32
+ cn : "child" ,
33
+ sn : "child" ,
34
+ mail : "child@rubyldap.com" ,
35
+ }
36
+ unless @ldap . search ( base : @parent_dn , scope : Net ::LDAP ::SearchScope_BaseObject )
37
+ assert @ldap . add ( dn : @parent_dn , attributes : parent_attrs ) , @ldap . get_operation_result . inspect
38
+ assert @ldap . add ( dn : @child_dn , attributes : child_attrs ) , @ldap . get_operation_result . inspect
39
+ end
40
+ assert @ldap . search ( base : @parent_dn , scope : Net ::LDAP ::SearchScope_BaseObject )
41
+ assert @ldap . search ( base : @child_dn , scope : Net ::LDAP ::SearchScope_BaseObject )
19
42
end
20
43
21
44
def test_delete
@@ -26,4 +49,14 @@ def test_delete
26
49
assert_equal Net ::LDAP ::ResultCodeNoSuchObject , result . code
27
50
assert_equal Net ::LDAP ::ResultStrings [ Net ::LDAP ::ResultCodeNoSuchObject ] , result . message
28
51
end
52
+
53
+ def test_delete_tree
54
+ assert @ldap . delete_tree ( dn : @parent_dn ) , @ldap . get_operation_result . inspect
55
+ refute @ldap . search ( base : @parent_dn , scope : Net ::LDAP ::SearchScope_BaseObject )
56
+ refute @ldap . search ( base : @child_dn , scope : Net ::LDAP ::SearchScope_BaseObject )
57
+
58
+ result = @ldap . get_operation_result
59
+ assert_equal Net ::LDAP ::ResultCodeNoSuchObject , result . code
60
+ assert_equal Net ::LDAP ::ResultStrings [ Net ::LDAP ::ResultCodeNoSuchObject ] , result . message
61
+ end
29
62
end
0 commit comments