summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2015-12-16 20:49:34 +0100
committerJan Lehnardt <jan@apache.org>2015-12-16 20:49:34 +0100
commit45588920afd4b143e9122ec428d5f896fb81ecf2 (patch)
treea056b082ef68544f0af069c488b5e6425f12beff
parentbb5d62586b2ad245687afbad245a5a2f7f5ca458 (diff)
downloadcouchdb-45588920afd4b143e9122ec428d5f896fb81ecf2.tar.gz
JS test: update view_errors.js for 2.0
-rw-r--r--test/javascript/tests/view_errors.js27
1 files changed, 15 insertions, 12 deletions
diff --git a/test/javascript/tests/view_errors.js b/test/javascript/tests/view_errors.js
index e8bd08e48..b53a3c764 100644
--- a/test/javascript/tests/view_errors.js
+++ b/test/javascript/tests/view_errors.js
@@ -11,16 +11,16 @@
// the License.
couchTests.view_errors = function(debug) {
- var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"true"});
- 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;
- run_on_modified_server(
- [{section: "couchdb",
- key: "os_process_timeout",
- value: "500"}],
- function() {
+ // run_on_modified_server(
+ // [{section: "couchdb",
+ // key: "os_process_timeout",
+ // value: "500"}],
+ // function() {
var doc = {integer: 1, string: "1", array: [1, 2, 3]};
T(db.save(doc).ok);
@@ -48,7 +48,7 @@ couchTests.view_errors = function(debug) {
T(results.rows[0].key[1] == null);
// querying a view with invalid params should give a resonable error message
- var xhr = CouchDB.request("POST", "/test_suite_db/_temp_view?startkey=foo", {
+ var xhr = CouchDB.request("POST", "/" + db_name + "/_all_docs?startkey=foo", {
headers: {"Content-Type": "application/json"},
body: JSON.stringify({language: "javascript",
map : "function(doc){emit(doc.integer)}"
@@ -57,7 +57,7 @@ couchTests.view_errors = function(debug) {
T(JSON.parse(xhr.responseText).error == "bad_request");
// content type must be json
- var xhr = CouchDB.request("POST", "/test_suite_db/_temp_view", {
+ var xhr = CouchDB.request("POST", "/" + db_name + "/_all_docs", {
headers: {"Content-Type": "application/x-www-form-urlencoded"},
body: JSON.stringify({language: "javascript",
map : "function(doc){}"
@@ -158,7 +158,7 @@ couchTests.view_errors = function(debug) {
}
// Check error responses for invalid multi-get bodies.
- var path = "/test_suite_db/_design/test/_view/no_reduce";
+ var path = "/" + db_name + "/_design/test/_view/no_reduce";
var xhr = CouchDB.request("POST", path, {body: "[]"});
T(xhr.status == 400);
result = JSON.parse(xhr.responseText);
@@ -172,7 +172,7 @@ couchTests.view_errors = function(debug) {
T(result.reason == "`keys` member must be a array.");
// if the reduce grows to fast, throw an overflow error
- var path = "/test_suite_db/_design/testbig/_view/reduce_too_big";
+ var path = "/" + db_name + "/_design/testbig/_view/reduce_too_big";
xhr = CouchDB.request("GET", path);
T(xhr.status == 500);
result = JSON.parse(xhr.responseText);
@@ -185,5 +185,8 @@ couchTests.view_errors = function(debug) {
T(e.error == "query_parse_error");
T(e.reason.match(/no rows can match/i));
}
- });
+ // });
+
+ // cleanup
+ db.deleteDb();
};