diff options
Diffstat (limited to 'testprogs')
-rwxr-xr-x | testprogs/ejs/ldap.js | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js index 561d5d86f8..a432c11653 100755 --- a/testprogs/ejs/ldap.js +++ b/testprogs/ejs/ldap.js @@ -36,7 +36,21 @@ objectClass: user objectClass: person cn: LDAPtestUSER "); - assert(ok); + if (!ok) { + println(ldb.errstring()); + assert(ok); + } + + ok = ldb.add(" +dn: cn=ldaptestuser2,cn=users," + base_dn + " +objectClass: user +objectClass: person +cn: LDAPtestUSER2 +"); + if (!ok) { + println(ldb.errstring()); + assert(ok); + } println("Testing ldb.search"); var res = ldb.search("(&(cn=ldaptestuser)(objectClass=user))"); @@ -48,7 +62,25 @@ cn: LDAPtestUSER assert(res[0].whenCreated != undefined); ok = ldb.del(res[0].dn); - assert(ok); + if (!ok) { + println(ldb.errstring()); + assert(ok); + } + + println("Testing ldb.search"); + var res = ldb.search("(&(cn=ldaptestUSer2)(objectClass=user))"); + + assert(res[0].dn == "cn=ldaptestuser2,cn=users," + base_dn); + assert(res[0].cn == "ldaptestuser2"); + assert(res[0].name == "ldaptestuser2"); + assert(res[0].objectGUID != undefined); + assert(res[0].whenCreated != undefined); + + ok = ldb.del(res[0].dn); + if (!ok) { + println(ldb.errstring()); + assert(ok); + } } function find_basedn(ldb) |