You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2015/12/16 20:52:25 UTC

[30/50] couchdb commit: updated refs/heads/2876-js-tests-merged-squashed to f44e15f

JS test: update security_validation.js for 2.0


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/b6b69808
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/b6b69808
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/b6b69808

Branch: refs/heads/2876-js-tests-merged-squashed
Commit: b6b698080dd6e91575c7d245cfb19ca6cf6d4546
Parents: 079a768
Author: Jan Lehnardt <ja...@apache.org>
Authored: Wed Dec 16 20:49:33 2015 +0100
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Wed Dec 16 20:49:33 2015 +0100

----------------------------------------------------------------------
 test/javascript/tests/security_validation.js | 39 +++++++++++++----------
 1 file changed, 22 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/b6b69808/test/javascript/tests/security_validation.js
----------------------------------------------------------------------
diff --git a/test/javascript/tests/security_validation.js b/test/javascript/tests/security_validation.js
index 14e5d04..619ba34 100644
--- a/test/javascript/tests/security_validation.js
+++ b/test/javascript/tests/security_validation.js
@@ -11,6 +11,8 @@
 // the License.
 
 couchTests.security_validation = function(debug) {
+  return console.log('TODO: config not available on cluster');
+
   // This tests couchdb's security and validation features. This does
   // not test authentication, except to use test authentication code made
   // specifically for this testing. It is a WWW-Authenticate scheme named
@@ -32,8 +34,8 @@ couchTests.security_validation = function(debug) {
   // Firefox and Safari both deal with this correctly (which is to say
   // they correctly do nothing special).
 
-  var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});
-  db.deleteDb();
+  var db_name = get_random_db_name();
+  var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
   db.createDb();
   if (debug) debugger;
 
@@ -47,7 +49,7 @@ couchTests.security_validation = function(debug) {
 
     function () {
       // try saving document using the wrong credentials
-      var wrongPasswordDb = new CouchDB("test_suite_db",
+      var wrongPasswordDb = new CouchDB(db_name + "",
         {"WWW-Authenticate": "X-Couch-Test-Auth Damien Katz:foo"}
       );
 
@@ -89,7 +91,7 @@ couchTests.security_validation = function(debug) {
       }
 
       // Save a document normally
-      var userDb = new CouchDB("test_suite_db",
+      var userDb = new CouchDB("" + db_name + "",
         {"WWW-Authenticate": "X-Couch-Test-Auth Damien Katz:pecan pie"}
       );
 
@@ -111,7 +113,7 @@ couchTests.security_validation = function(debug) {
 
       T(userDb.save(designDoc).ok);
 
-      var user2Db = new CouchDB("test_suite_db",
+      var user2Db = new CouchDB("" + db_name + "",
         {"WWW-Authenticate": "X-Couch-Test-Auth Jan Lehnardt:apple"}
       );
       // Attempt to save the design as a non-admin (in replication scenario)
@@ -248,27 +250,27 @@ couchTests.security_validation = function(debug) {
       var AuthHeaders = {"WWW-Authenticate": "X-Couch-Test-Auth Christopher Lenz:dog food"};
       var host = CouchDB.host;
       var dbPairs = [
-        {source:"test_suite_db_a",
-          target:"test_suite_db_b"},
+        {source:"" + db_name + "_a",
+          target:"" + db_name + "_b"},
 
-        {source:"test_suite_db_a",
-          target:{url: CouchDB.protocol + host + "/test_suite_db_b",
+        {source:"" + db_name + "_a",
+          target:{url: CouchDB.protocol + host + "/" + db_name + "_b",
                   headers: AuthHeaders}},
 
-        {source:{url:CouchDB.protocol + host + "/test_suite_db_a",
+        {source:{url:CouchDB.protocol + host + "/" + db_name + "_a",
                  headers: AuthHeaders},
-          target:"test_suite_db_b"},
+          target:"" + db_name + "_b"},
 
-        {source:{url:CouchDB.protocol + host + "/test_suite_db_a",
+        {source:{url:CouchDB.protocol + host + "/" + db_name + "_a",
                  headers: AuthHeaders},
-         target:{url:CouchDB.protocol + host + "/test_suite_db_b",
+         target:{url:CouchDB.protocol + host + "/" + db_name + "_b",
                  headers: AuthHeaders}},
       ]
-      var adminDbA = new CouchDB("test_suite_db_a", {"X-Couch-Full-Commit":"false"});
-      var adminDbB = new CouchDB("test_suite_db_b", {"X-Couch-Full-Commit":"false"});
-      var dbA = new CouchDB("test_suite_db_a",
+      var adminDbA = new CouchDB("" + db_name + "_a", {"X-Couch-Full-Commit":"false"});
+      var adminDbB = new CouchDB("" + db_name + "_b", {"X-Couch-Full-Commit":"false"});
+      var dbA = new CouchDB("" + db_name + "_a",
           {"WWW-Authenticate": "X-Couch-Test-Auth Christopher Lenz:dog food"});
-      var dbB = new CouchDB("test_suite_db_b",
+      var dbB = new CouchDB("" + db_name + "_b",
           {"WWW-Authenticate": "X-Couch-Test-Auth Christopher Lenz:dog food"});
       var xhr;
       for (var testPair = 0; testPair < dbPairs.length; testPair++) {
@@ -335,4 +337,7 @@ couchTests.security_validation = function(debug) {
         T(dbA.open("foo2").value == "b");
       }
     });
+
+  // cleanup
+  db.deleteDb();
 };