summaryrefslogtreecommitdiff
path: root/share/www/script/test/security_validation.js
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2010-07-29 06:05:01 +0000
committerJohn Christopher Anderson <jchris@apache.org>2010-07-29 06:05:01 +0000
commit92b5780638312375e049269e77f1d41a0d5a9f67 (patch)
tree70f50026e4a27fb1f135fda9687c1e53890abf0c /share/www/script/test/security_validation.js
parent35809c88d6deea2b55f841e8e8a76e4900525bf0 (diff)
fix the underlying issue that was giving replication problems attempting to push design docs as a non-admin. this is what my reverted commit should have been
git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.0.x@980320 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test/security_validation.js')
-rw-r--r--share/www/script/test/security_validation.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/share/www/script/test/security_validation.js b/share/www/script/test/security_validation.js
index 67b04f3c..e0ab17d6 100644
--- a/share/www/script/test/security_validation.js
+++ b/share/www/script/test/security_validation.js
@@ -111,6 +111,18 @@ couchTests.security_validation = function(debug) {
T(userDb.save(designDoc).ok);
+ var user2Db = new CouchDB("test_suite_db",
+ {"WWW-Authenticate": "X-Couch-Test-Auth Jan Lehnardt:apple"}
+ );
+ // Attempt to save the design as a non-admin (in replication scenario)
+ try {
+ user2Db.save(designDoc, {new_edits : false});
+ T(false && "Can't get here. Should have thrown an error on design doc");
+ } catch (e) {
+ T(e.error == "unauthorized");
+ T(user2Db.last_req.status == 401);
+ }
+
// test the _session API
var resp = userDb.request("GET", "/_session");
var user = JSON.parse(resp.responseText).userCtx;
@@ -134,10 +146,6 @@ couchTests.security_validation = function(debug) {
}
// Now attempt to update the document as a different user, Jan
- var user2Db = new CouchDB("test_suite_db",
- {"WWW-Authenticate": "X-Couch-Test-Auth Jan Lehnardt:apple"}
- );
-
var doc = user2Db.open("testdoc");
doc.foo=3;
try {