diff options
author | Paul Joseph Davis <davisp@apache.org> | 2009-05-09 19:06:08 +0000 |
---|---|---|
committer | Paul Joseph Davis <davisp@apache.org> | 2009-05-09 19:06:08 +0000 |
commit | d748a328aec166047c81bcaf3dec6b0a885a2088 (patch) | |
tree | 8b4acc9f4737bbe9c367b8661cb25d3bbdf0a56e /share/www | |
parent | 4edf64eb3c747f31b63001b7c6bbab0d6f2a7eeb (diff) |
Check for invalid document members.
Removes a guard that only checked for fields with integer values. Adds tests to
basics.js
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@773260 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www')
-rw-r--r-- | share/www/script/test/basics.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/share/www/script/test/basics.js b/share/www/script/test/basics.js index 2eb49ebe..8e6d4c7a 100644 --- a/share/www/script/test/basics.js +++ b/share/www/script/test/basics.js @@ -169,6 +169,28 @@ couchTests.basics = function(debug) { xhr = CouchDB.request("DELETE", "/test_suite_db/doc-does-not-exist"); T(xhr.status == 404); + // Check for invalid document members + bad_docs = [ + ["goldfish", {"_zing": 4}], + ["zebrafish", {"_zoom": "hello"}], + ["mudfish", {"zane": "goldfish", "_fan": "something smells delicious"}], + ["tastyfish", {"_bing": {"wha?": "soda can"}}] + ] + var test_doc = function(info) { + var data = JSON.stringify(info[1]); + + xhr = CouchDB.request("PUT", "/test_suite_db/" + info[0], {body: data}); + T(xhr.status == 500); + result = JSON.parse(xhr.responseText); + T(result.error == "doc_validation"); + + xhr = CouchDB.request("POST", "/test_suite_db/", {body: data}); + T(xhr.status == 500); + result = JSON.parse(xhr.responseText); + T(result.error == "doc_validation"); + }; + bad_docs.forEach(test_doc); + // Check some common error responses. // PUT body not an object xhr = CouchDB.request("PUT", "/test_suite_db/bar", {body: "[]"}); |