summaryrefslogtreecommitdiff
path: root/test/etap
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2011-07-04 14:35:13 +0000
committerJan Lehnardt <jan@apache.org>2011-07-04 14:35:13 +0000
commit5fa79a85bcb2eea059fd948e89433965f8160b1f (patch)
treee5ec590d131435ac72b10a783b09cc6d4e6b993b /test/etap
parent6ef446ab98848d1b2b42785a1826567627af8e7a (diff)
Backport r1142685 from trunk: Allow "/" as vhost target.
Includes a one-line whitespace fix. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1142689 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/etap')
-rwxr-xr-xtest/etap/160-vhosts.t14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/etap/160-vhosts.t b/test/etap/160-vhosts.t
index 8dac53e5..4bb8e926 100755
--- a/test/etap/160-vhosts.t
+++ b/test/etap/160-vhosts.t
@@ -52,7 +52,7 @@ admin_user_ctx() -> {user_ctx, #user_ctx{roles=[<<"_admin">>]}}.
main(_) ->
test_util:init_code_path(),
- etap:plan(14),
+ etap:plan(15),
case (catch test()) of
ok ->
etap:end_tests();
@@ -115,6 +115,7 @@ test() ->
ok = couch_config:set("vhosts", "*.example2.com/test", "/*", false),
ok = couch_config:set("vhosts", "*/test1",
"/etap-test-db/_design/doc1/_show/test", false),
+ ok = couch_config:set("vhosts", "example3.com", "/", false),
% let couch_httpd restart
timer:sleep(100),
@@ -133,6 +134,7 @@ test() ->
test_vhost_request_path1(),
test_vhost_request_path2(),
test_vhost_request_path3(),
+ test_vhost_request_to_root(),
%% restart boilerplate
couch_db:close(Db),
@@ -289,3 +291,13 @@ test_vhost_request_path3() ->
end, true, <<"path in req ok">>);
_Else -> etap:is(false, true, <<"ibrowse fail">>)
end.
+
+test_vhost_request_to_root() ->
+ Uri = server(),
+ case ibrowse:send_req(Uri, [], get, [], []) of
+ {ok, _, _, Body} ->
+ {JsonBody} = couch_util:json_decode(Body),
+ HasCouchDBWelcome = proplists:is_defined(<<"couchdb">>, JsonBody),
+ etap:is(HasCouchDBWelcome, true, "should allow redirect to /");
+ _Else -> etap:is(false, true, <<"ibrowse fail">>)
+ end.