diff options
author | Jason Smith (air) <jhs@apache.org> | 2012-02-29 10:15:09 +0000 |
---|---|---|
committer | Jason Smith (air) <jhs@apache.org> | 2012-02-29 10:15:09 +0000 |
commit | 33db9434bef7e34ebc92278752c5b1325ce9ed0d (patch) | |
tree | 7116be992145ff5512010518898360a25dc7dddc | |
parent | 1bc8c493accf71fcf06418e46aadd36bdc2a42df (diff) | |
download | couchdb-33db9434bef7e34ebc92278752c5b1325ce9ed0d.tar.gz |
More thorough vhost and rewrite testing
-rw-r--r-- | share/www/script/test/rewrite.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/share/www/script/test/rewrite.js b/share/www/script/test/rewrite.js index 0262bb646..c69c216c0 100644 --- a/share/www/script/test/rewrite.js +++ b/share/www/script/test/rewrite.js @@ -443,8 +443,13 @@ couchTests.rewrite = function(debug) { var rw_ddoc = { _id: "_design/rwtest", rewrites: [ + {"from":"testShow", "to":"_show/show_requested_path"}, {"from":"path/testShow","to":"_show/show_requested_path"}, - {"from":"_config/*","to":"../../../_config/*"} + {"from":"_config/*","to":"../../../_config/*"}, + + {"from":"one", "to":"_rewrite/two"}, + {"from":"two", "to":"_rewrite/three"}, + {"from":"three", "to":"_rewrite/testShow"} ], shows : { show_requested_path : stringFun(function(doc, req){ @@ -456,7 +461,11 @@ couchTests.rewrite = function(debug) { T(db.save(rw_ddoc).ok); // try accessing directly - var res = CouchDB.request("GET", "/test_suite_db/_design/rwtest/_rewrite/path/testShow"); + var res = CouchDB.request("GET", "/test_suite_db/_design/rwtest/_rewrite/testShow"); + TEquals('/test_suite_db/_design/rwtest/_rewrite/testShow', + res.responseText, "requested_path should equal requested"); + + res = CouchDB.request("GET", "/test_suite_db/_design/rwtest/_rewrite/path/testShow"); TEquals('/test_suite_db/_design/rwtest/_rewrite/path/testShow', res.responseText, "requested_path should equal requested"); @@ -468,6 +477,13 @@ couchTests.rewrite = function(debug) { run_on_modified_server([vhosts], function() { var res = CouchDB.request("GET", "/path/testShow"); TEquals('/path/testShow', res.responseText, "requested_path should equal requested"); + + res = CouchDB.request("GET", "/testShow"); + TEquals('/testShow', res.responseText, "requested_path should equal requested"); + + // Test multiple rewrites. + res = CouchDB.request("GET", "/one"); + TEquals("/one", res.responseText, "requested_path works through multiple rewrites"); }); // Test a vhost to a path within the rewrite namespace. |