From dd60d8187d7fcaa1479a74e870e8e74f6c83843d Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Thu, 29 Jul 2010 06:04:03 +0000 Subject: 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/trunk@980319 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/test/security_validation.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'share/www/script/test/security_validation.js') diff --git a/share/www/script/test/security_validation.js b/share/www/script/test/security_validation.js index 5bd70cd0..415c8e70 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 { -- cgit v1.2.3