diff options
Diffstat (limited to 'testprogs/ejs')
-rwxr-xr-x | testprogs/ejs/ldap.js | 56 | ||||
-rwxr-xr-x | testprogs/ejs/ldb.js | 3 |
2 files changed, 59 insertions, 0 deletions
diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js new file mode 100755 index 0000000000..bba81f3971 --- /dev/null +++ b/testprogs/ejs/ldap.js @@ -0,0 +1,56 @@ +#!/bin/sh +exec smbscript "$0" ${1+"$@"} +/* + test certin LDAP behaviours +*/ + +var ldb = ldb_init(); + +var options = new Object(); + +ok = GetOptions(ARGV, options, + "POPT_AUTOHELP", + "POPT_COMMON_SAMBA", + "POPT_COMMON_CREDENTIALS"); +if (ok == false) { + println("Failed to parse options: " + options.ERROR); + return -1; +} + +if (options.ARGV.length != 2) { + println("Usage: ldap.js <BASEDN> <HOST>"); + return -1; +} + +var base_dn = options.ARGV[0]; +var host = options.ARGV[1]; + +function basic_tests(ldb, base_dn) +{ + println("Running basic tests"); + + ldb.del("cn=ldaptestuser,cn=users," + base_dn); + + ok = ldb.add(" +dn: cn=ldaptestuser,cn=users," + base_dn + " +objectClass: user +objectClass: person +cn: LDAPtestUSER +"); + assert(ok); + + println("Testing ldb.search"); + var res = ldb.search("(&(cn=ldaptestuser)(objectClass=user))"); + + assert(res[0].dn == "cn=ldaptestuser,cn=users," + base_dn); + assert(res[0].cn == "ldaptestuser"); + assert(res[0].name == "ldaptestuser"); + assert(res[0].objectGUID != undefined); + assert(res[0].whenCreated != undefined); + +} + +var ok = ldb.connect("ldap://" + host); +basic_tests(ldb, base_dn) + +return 0; diff --git a/testprogs/ejs/ldb.js b/testprogs/ejs/ldb.js index ea090a65b7..812c5a5b96 100755 --- a/testprogs/ejs/ldb.js +++ b/testprogs/ejs/ldb.js @@ -86,6 +86,7 @@ x: 8 dn: cn=x9,cn=test objectClass: foo x: 9 +cn: X9 "); assert(ok); @@ -94,12 +95,14 @@ x: 9 assert(res[0].createTimestamp != undefined); assert(res[0].whenCreated != undefined); assert(res[0].name == "x8"); + assert(res[0].cn == "x8"); var res2 = ldb.search("x=9", NULL, ldb.SCOPE_DEFAULT); assert(res2[0].objectGUID != undefined); assert(res2[0].createTimestamp != undefined); assert(res2[0].whenCreated != undefined); assert(res2[0].name == "x9"); + assert(res2[0].cn == "x9"); assert(res[0].objectGUID != res2[0].objectGUID); |