summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2015-12-16 20:49:33 +0100
committerJan Lehnardt <jan@apache.org>2015-12-16 20:49:33 +0100
commitb6b698080dd6e91575c7d245cfb19ca6cf6d4546 (patch)
tree8ee416a70cec4f670242229945cc80b43d245ee2
parent079a76874a59b4b747793752b89a2e912fa3026f (diff)
downloadcouchdb-b6b698080dd6e91575c7d245cfb19ca6cf6d4546.tar.gz
JS test: update security_validation.js for 2.0
-rw-r--r--test/javascript/tests/security_validation.js39
1 files changed, 22 insertions, 17 deletions
diff --git a/test/javascript/tests/security_validation.js b/test/javascript/tests/security_validation.js
index 14e5d040c..619ba341d 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();
};