diff options
Diffstat (limited to 'share/www')
-rw-r--r-- | share/www/script/test/etags_views.js | 23 | ||||
-rw-r--r-- | share/www/script/test/list_views.js | 22 |
2 files changed, 45 insertions, 0 deletions
diff --git a/share/www/script/test/etags_views.js b/share/www/script/test/etags_views.js index 8d248983..a12734f8 100644 --- a/share/www/script/test/etags_views.js +++ b/share/www/script/test/etags_views.js @@ -63,6 +63,29 @@ couchTests.etags_views = function(debug) { }); T(xhr.status == 304); + // confirm ETag changes with different POST bodies + xhr = CouchDB.request("POST", "/test_suite_db/_design/etags/_view/basicView", + {body: JSON.stringify({keys:[1]})} + ); + var etag1 = xhr.getResponseHeader("etag"); + xhr = CouchDB.request("POST", "/test_suite_db/_design/etags/_view/basicView", + {body: JSON.stringify({keys:[2]})} + ); + var etag2 = xhr.getResponseHeader("etag"); + T(etag1 != etag2, "POST to map view generates key-depdendent ETags"); + + xhr = CouchDB.request("POST", + "/test_suite_db/_design/etags/_view/withReduce?group=true", + {body: JSON.stringify({keys:[1]})} + ); + etag1 = xhr.getResponseHeader("etag"); + xhr = CouchDB.request("POST", + "/test_suite_db/_design/etags/_view/withReduce?group=true", + {body: JSON.stringify({keys:[2]})} + ); + etag2 = xhr.getResponseHeader("etag"); + T(etag1 != etag2, "POST to reduce view generates key-depdendent ETags"); + // all docs xhr = CouchDB.request("GET", "/test_suite_db/_all_docs"); T(xhr.status == 200); diff --git a/share/www/script/test/list_views.js b/share/www/script/test/list_views.js index e31f0f83..d0400ff9 100644 --- a/share/www/script/test/list_views.js +++ b/share/www/script/test/list_views.js @@ -224,6 +224,17 @@ couchTests.list_views = function(debug) { headers: {"if-none-match": etag} }); T(xhr.status == 304); + + // confirm ETag changes with different POST bodies + xhr = CouchDB.request("POST", "/test_suite_db/_design/lists/_list/basicBasic/basicView", + {body: JSON.stringify({keys:[1]})} + ); + var etag1 = xhr.getResponseHeader("etag"); + xhr = CouchDB.request("POST", "/test_suite_db/_design/lists/_list/basicBasic/basicView", + {body: JSON.stringify({keys:[2]})} + ); + var etag2 = xhr.getResponseHeader("etag"); + T(etag1 != etag2, "POST to map _list generates key-depdendent ETags"); // test the richness of the arguments xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/basicJSON/basicView"); @@ -310,6 +321,17 @@ couchTests.list_views = function(debug) { }); T(xhr.status == 304); + // confirm ETag changes with different POST bodies + xhr = CouchDB.request("POST", "/test_suite_db/_design/lists/_list/simpleForm/withReduce?group=true", + {body: JSON.stringify({keys:[1]})} + ); + var etag1 = xhr.getResponseHeader("etag"); + xhr = CouchDB.request("POST", "/test_suite_db/_design/lists/_list/simpleForm/withReduce?group=true", + {body: JSON.stringify({keys:[2]})} + ); + var etag2 = xhr.getResponseHeader("etag"); + T(etag1 != etag2, "POST to reduce _list generates key-depdendent ETags"); + // verify the etags expire correctly var docs = makeDocs(11, 12); db.bulkSave(docs); |