diff options
author | Andrew Bartlett <abartlet@samba.org> | 2005-07-24 22:18:01 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:30:00 -0500 |
commit | 77e52a4e2c4587785930491695486b2d8b26b509 (patch) | |
tree | 69ed11155996d98ae3ab73062f9f6592bacc24a2 /testprogs/ejs | |
parent | 79cac4b6e2f1b4e808930cb584c20c11b5df903f (diff) | |
download | samba-77e52a4e2c4587785930491695486b2d8b26b509.tar.gz samba-77e52a4e2c4587785930491695486b2d8b26b509.tar.bz2 samba-77e52a4e2c4587785930491695486b2d8b26b509.zip |
r8738: Test (using ejs!) the basic operation of the ldb modules.
ejs seems to test this stuff very nicely!
Andrew Bartlett
(This used to be commit 325f6d24dfc285587bde9fea6eeaf136c2731eff)
Diffstat (limited to 'testprogs/ejs')
-rwxr-xr-x | testprogs/ejs/ldb.js | 64 |
1 files changed, 60 insertions, 4 deletions
diff --git a/testprogs/ejs/ldb.js b/testprogs/ejs/ldb.js index 819192b51e..ea090a65b7 100755 --- a/testprogs/ejs/ldb.js +++ b/testprogs/ejs/ldb.js @@ -6,7 +6,7 @@ exec smbscript "$0" ${1+"$@"} var ldb = ldb_init(); - +var sys; function basic_tests(ldb) { println("Running basic tests"); @@ -53,16 +53,72 @@ x: 7 res = ldb.search("x=7"); assert(res.length == 1); assert(res[0].x.length == 2); + + /* Check a few things before we add modules */ + assert(res[0].objectGUID == undefined); + assert(res[0].createTimestamp == undefined); + assert(res[0].whenCreated == undefined); + +} +function setup_modules(ldb) +{ + ok = ldb.add(" +dn: @MODULES +@LIST: timestamps,objectguid,rdn_name +"); +} + +/* Test the basic operation of the timestamps,objectguid and name_rdn + modules */ + +function modules_test(ldb) +{ + println("Running modules tests"); + ok = ldb.add(" +dn: cn=x8,cn=test +objectClass: foo +x: 8 +"); + assert(ok); + + ok = ldb.add(" +dn: cn=x9,cn=test +objectClass: foo +x: 9 +"); + assert(ok); + + var res = ldb.search("x=8", NULL, ldb.SCOPE_DEFAULT); + assert(res[0].objectGUID != undefined); + assert(res[0].createTimestamp != undefined); + assert(res[0].whenCreated != undefined); + assert(res[0].name == "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(res[0].objectGUID != res2[0].objectGUID); + } -sys_init(ldb); +sys = sys_init(); var dbfile = "test.ldb"; -ldb.unlink(dbfile); +sys.unlink(dbfile); var ok = ldb.connect("tdb://" + dbfile); assert(ok); basic_tests(ldb); -ldb.unlink(dbfile); +setup_modules(ldb); +ldb = ldb_init(); +var ok = ldb.connect("tdb://" + dbfile); +assert(ok); + +modules_test(ldb); + +sys.unlink(dbfile); return 0; |