diff options
author | Benoit Chesneau <benoitc@apache.org> | 2010-08-18 18:54:40 +0000 |
---|---|---|
committer | Benoit Chesneau <benoitc@apache.org> | 2010-08-18 18:54:40 +0000 |
commit | 1f729f7f261f9607b74b6c8723e190720db8dc32 (patch) | |
tree | 5748a7900e02b409811b9804d4e7fa1fc5a75c44 /share/www/script/test | |
parent | 4b0f69f2fa9a8a6ead5ad62c1ebacfc50ede4591 (diff) |
expose security obj to shows, lists & updates functions.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@986854 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test')
-rw-r--r-- | share/www/script/test/list_views.js | 12 | ||||
-rw-r--r-- | share/www/script/test/show_documents.js | 22 |
2 files changed, 34 insertions, 0 deletions
diff --git a/share/www/script/test/list_views.js b/share/www/script/test/list_views.js index f826b46f..048fc5e3 100644 --- a/share/www/script/test/list_views.js +++ b/share/www/script/test/list_views.js @@ -156,6 +156,9 @@ couchTests.list_views = function(debug) { var row = getRow(); send(row.doc.integer); return "tail"; + }), + secObj: stringFun(function(head, req) { + return toJSON(req.secObj); }) } }; @@ -201,6 +204,7 @@ couchTests.list_views = function(debug) { T(xhr.status == 200, "standard get should be 200"); T(/head0123456789tail/.test(xhr.responseText)); + // test that etags are available var etag = xhr.getResponseHeader("etag"); xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/basicBasic/basicView", { @@ -405,6 +409,12 @@ couchTests.list_views = function(debug) { T(/FirstKey: -2/.test(xhr.responseText)); T(/LastKey: -7/.test(xhr.responseText)); + // Test if secObj is available + var xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/secObj/basicView"); + T(xhr.status == 200, "standard get should be 200"); + var resp = JSON.parse(xhr.responseText); + T(typeof(resp) == "object"); + var erlViewTest = function() { T(db.save(erlListDoc).ok); var url = "/test_suite_db/_design/erlang/_list/simple/views/basicView" + @@ -419,6 +429,8 @@ couchTests.list_views = function(debug) { } }; + + run_on_modified_server([{ section: "native_query_servers", key: "erlang", diff --git a/share/www/script/test/show_documents.js b/share/www/script/test/show_documents.js index e06bcadc..55ed9698 100644 --- a/share/www/script/test/show_documents.js +++ b/share/www/script/test/show_documents.js @@ -157,6 +157,9 @@ couchTests.show_documents = function(debug) { }), "withSlash": stringFun(function(doc, req) { return { json: doc } + }), + "secObj": stringFun(function(doc, req) { + return { json: req.secObj }; }) } }; @@ -410,5 +413,24 @@ couchTests.show_documents = function(debug) { db.deleteDoc(doc); var xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/show-deleted/testdoc"); TEquals("No doc testdoc", xhr.responseText, "should return 'no doc testdoc'"); + + + run_on_modified_server( + [{section: "httpd", + key: "authentication_handlers", + value: "{couch_httpd_auth, special_test_authentication_handler}"}, + {section:"httpd", + key: "WWW-Authenticate", + value: "X-Couch-Test-Auth"}], + + function() { + T(db.setDbProperty("_security", {foo: true}).ok); + T(db.save(doc).ok); + + xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/secObj"); + var resp = JSON.parse(xhr.responseText); + T(resp.foo == true); + } + ); }; |