svn commit: samba r8738 - in branches/SAMBA_4_0/testprogs/ejs: .

abartlet at samba.org abartlet at samba.org
Sun Jul 24 22:18:02 GMT 2005


Author: abartlet
Date: 2005-07-24 22:18:01 +0000 (Sun, 24 Jul 2005)
New Revision: 8738

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8738

Log:
Test (using ejs!) the basic operation of the ldb modules.

ejs seems to test this stuff very nicely!

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/testprogs/ejs/ldb.js


Changeset:
Modified: branches/SAMBA_4_0/testprogs/ejs/ldb.js
===================================================================
--- branches/SAMBA_4_0/testprogs/ejs/ldb.js	2005-07-24 13:25:16 UTC (rev 8737)
+++ branches/SAMBA_4_0/testprogs/ejs/ldb.js	2005-07-24 22:18:01 UTC (rev 8738)
@@ -6,7 +6,7 @@
 
 
 var ldb = ldb_init();
-
+var sys;
 function basic_tests(ldb)
 {
 	println("Running basic tests");
@@ -53,16 +53,72 @@
 	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
+ at LIST: timestamps,objectguid,rdn_name
+");
 }
 
-sys_init(ldb);
+/* 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 = 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;



More information about the samba-cvs mailing list