r25760: Test out relative distinguished name behaviour under renames.
authorAndrew Bartlett <abartlet@samba.org>
Wed, 31 Oct 2007 01:50:13 +0000 (02:50 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:43:47 +0000 (05:43 +0100)
Andrew Bartlett

testprogs/ejs/ldap.js

index 65e13a479db631d872702f21348e8c3306cbc6f5..c3003355b526fba0e80ec939e32486e2eb5d4e0f 100755 (executable)
@@ -150,6 +150,30 @@ cn: LDAPtestUSER2
                assert(ok.error == 0);
        }
 
+       ok = ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser3,cn=users," + base_dn);
+       if (ok.error != 0) {
+               println("Could not rename cn=ldaptestuser3,cn=users," + base_dn + " onto itself: " + ok.errstr);
+               assert(ok.error == 0);
+       }
+
+       ok = ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestUSER3,cn=users," + base_dn);
+       if (ok.error != 0) {
+               println("Could not rename cn=ldaptestuser3,cn=users," + base_dn + " into cn=ldaptestUSER3,cn=users," + base_dn + ": " + ok.errstr);
+               assert(ok.error == 0);
+       }
+
+       println("Testing ldb.search for (&(cn=ldaptestuser3)(objectClass=user))");
+       var res = ldb.search("(&(cn=ldaptestuser3)(objectClass=user))");
+       if (res.error != 0 || res.msgs.length != 1) {
+               println("Could not find (&(cn=ldaptestuser3)(objectClass=user))");
+               assert(res.error == 0);
+               assert(res.msgs.length == 1);
+       }
+
+       assert(res.msgs[0].dn == ("CN=ldaptestUSER3,CN=Users," + base_dn));
+       assert(res.msgs[0].cn == "ldaptestUSER3");
+       assert(res.msgs[0].name == "ldaptestUSER3");
+
        // ensure we cannot add it again
        ok = ldb.add("
 dn: cn=ldaptestuser3,cn=userS," + base_dn + "