From 0e0e8d3375cb4b7ebb1edd25ac9302f6e22e2b93 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Mon, 25 Apr 2011 23:46:12 +0000 Subject: Fix vhosts for https and fix vhost dependence on sorting of values in the config system which isn't guaranteed. Make vhost test cases more robust. Closes COUCHDB-1103 Source patch by Benoit and tests patch by me. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1096636 13f79535-47bb-0310-9956-ffa450edef68 --- test/etap/160-vhosts.t | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/etap/160-vhosts.t b/test/etap/160-vhosts.t index c7dc8f99..8dac53e5 100755 --- a/test/etap/160-vhosts.t +++ b/test/etap/160-vhosts.t @@ -155,9 +155,9 @@ test_regular_request() -> test_vhost_request() -> case ibrowse:send_req(server(), [], get, [], [{host_header, "example.com"}]) of {ok, _, _, Body} -> - {[{<<"db_name">>, <<"etap-test-db">>},_,_,_,_,_,_,_,_,_]} - = couch_util:json_decode(Body), - etap:is(true, true, "should return database info"); + {JsonBody} = couch_util:json_decode(Body), + HasDbNameInfo = proplists:is_defined(<<"db_name">>, JsonBody), + etap:is(HasDbNameInfo, true, "should return database info"); _Else -> etap:is(false, true, <<"ibrowse fail">>) end. @@ -222,9 +222,9 @@ test_vhost_request_wildcard()-> test_vhost_request_replace_var() -> case ibrowse:send_req(server(), [], get, [], [{host_header,"etap-test-db.example1.com"}]) of {ok, _, _, Body} -> - {[{<<"db_name">>, <<"etap-test-db">>},_,_,_,_,_,_,_,_,_]} - = couch_util:json_decode(Body), - etap:is(true, true, "should return database info"); + {JsonBody} = couch_util:json_decode(Body), + HasDbNameInfo = proplists:is_defined(<<"db_name">>, JsonBody), + etap:is(HasDbNameInfo, true, "should return database info"); _Else -> etap:is(false, true, <<"ibrowse fail">>) end. @@ -242,9 +242,9 @@ test_vhost_request_replace_var1() -> test_vhost_request_replace_wildcard() -> case ibrowse:send_req(server(), [], get, [], [{host_header,"etap-test-db.example2.com"}]) of {ok, _, _, Body} -> - {[{<<"db_name">>, <<"etap-test-db">>},_,_,_,_,_,_,_,_,_]} - = couch_util:json_decode(Body), - etap:is(true, true, "should return database info"); + {JsonBody} = couch_util:json_decode(Body), + HasDbNameInfo = proplists:is_defined(<<"db_name">>, JsonBody), + etap:is(HasDbNameInfo, true, "should return database info"); _Else -> etap:is(false, true, <<"ibrowse fail">>) end. @@ -252,9 +252,9 @@ test_vhost_request_path() -> Uri = server() ++ "test", case ibrowse:send_req(Uri, [], get, [], [{host_header, "example.com"}]) of {ok, _, _, Body} -> - {[{<<"db_name">>, <<"etap-test-db">>},_,_,_,_,_,_,_,_,_]} - = couch_util:json_decode(Body), - etap:is(true, true, "should return database info"); + {JsonBody} = couch_util:json_decode(Body), + HasDbNameInfo = proplists:is_defined(<<"db_name">>, JsonBody), + etap:is(HasDbNameInfo, true, "should return database info"); _Else -> etap:is(false, true, <<"ibrowse fail">>) end. @@ -272,9 +272,9 @@ test_vhost_request_path2() -> Uri = server() ++ "test", case ibrowse:send_req(Uri, [], get, [], [{host_header,"etap-test-db.example2.com"}]) of {ok, _, _, Body} -> - {[{<<"db_name">>, <<"etap-test-db">>},_,_,_,_,_,_,_,_,_]} - = couch_util:json_decode(Body), - etap:is(true, true, "should return database info"); + {JsonBody} = couch_util:json_decode(Body), + HasDbNameInfo = proplists:is_defined(<<"db_name">>, JsonBody), + etap:is(HasDbNameInfo, true, "should return database info"); _Else -> etap:is(false, true, <<"ibrowse fail">>) end. -- cgit v1.2.3