From 6b5676f0929b5f5da3e37e985484494bf3675b94 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Fri, 10 Oct 2008 02:23:11 +0000 Subject: config web service fix from davisp git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@703315 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/couch_tests.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'share') diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js index e88c68d1..0339dda6 100644 --- a/share/www/script/couch_tests.js +++ b/share/www/script/couch_tests.js @@ -1857,6 +1857,36 @@ var tests = { T(rows[(2*(i-4))+1].key == i+1); } T(db.view("test/single_doc").total_rows == 0); + }, + + config : function(debug) { + var db = new CouchDB("test_suite_db"); + db.deleteDb(); + db.createDb(); + if (debug) debugger; + + // test that /_config returns all the settings + var xhr = CouchDB.request("GET", "/_config"); + var config = JSON.parse(xhr.responseText); + T(config.couchdb.database_dir); + T(config.httpd.port == CouchDB.port); + T(config.daemons.httpd); + T(config.httpd_global_handlers._config); + T(config.log.level); + T(config.query_servers.javascript); + + // test that settings can be altered + xhr = CouchDB.request("PUT", "/_config/test/foo",{ + body : "bar" + }); + T(xhr.status == 200); + xhr = CouchDB.request("GET", "/_config/test"); + config = JSON.parse(xhr.responseText); + T(config.foo == "bar"); + + // you can get a single key + xhr = CouchDB.request("GET", "/_config/test/foo"); + T(xhr.responseText == '"bar"'); } }; -- cgit v1.2.3