Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Small changes to the CORS test

I looked through the patches on JIRA and found that the tests had moved
around a couple times. So I'm bring it all together.

- Use a new number, 250-cors.t. Found two patches on JIRA, one with
  221 and one with 230. New etap tests have been committed since, so
  I decided to bump the number.

- Added the CORS test to test/etap/Makefile.am

- Removed trailing whitespace
  • Loading branch information...
commit 2ccda64bbffdfa96e8b9817d42788715ca3adb5f 1 parent 8de5e72
Randall Leeds tilgovi authored
Showing with 13 additions and 12 deletions.
  1. +11 −11 test/etap/{221-cors.t → 250-cors.t}
  2. +2 −1  test/etap/Makefile.am
22 test/etap/221-cors.t → test/etap/250-cors.t
View
@@ -49,9 +49,9 @@ admin_user_ctx() -> {user_ctx, #user_ctx{roles=[<<"_admin">>]}}.
set_admin_password(UserName, Password) ->
Salt = binary_to_list(couch_uuids:random()),
Hashed = couch_util:to_hex(crypto:sha(Password ++ Salt)),
- couch_config:set("admins", UserName,
+ couch_config:set("admins", UserName,
"-hashed-" ++ Hashed ++ "," ++ Salt, false).
-
+
secobj() ->
{[
@@ -66,7 +66,7 @@ secobj2() ->
{<<"admins">>, {[{<<"names">>, []}, {<<"roles">>, []}]}}
]}.
-
+
test() ->
%% launch couchdb
couch_server_sup:start_link(test_util:config_files()),
@@ -82,8 +82,8 @@ test() ->
{ok, Db1} = couch_db:create(list_to_binary(dbname1()), [admin_user_ctx()]),
{ok, Db2} = couch_db:create(list_to_binary(dbname2()), [admin_user_ctx()]),
- ok = couch_db:set_security(Db1, secobj()),
- ok = couch_db:set_security(Db2, secobj2()),
+ ok = couch_db:set_security(Db1, secobj()),
+ ok = couch_db:set_security(Db2, secobj2()),
%% do tests
test_simple_request(),
@@ -96,7 +96,7 @@ test() ->
%% do tests with auth
ok = set_admin_password("test", "test"),
-
+
test_db_preflight_auth_request(),
test_db_origin_auth_request(),
@@ -126,10 +126,10 @@ test_simple_request() ->
end.
test_preflight_request() ->
- Headers = [{"Origin", "http://127.0.0.1"},
+ Headers = [{"Origin", "http://127.0.0.1"},
{"Access-Control-Request-Method", "GET"}],
case ibrowse:send_req(server(), Headers, options, []) of
- {ok, _, RespHeaders, _} ->
+ {ok, _, RespHeaders, _} ->
etap:is(proplists:get_value("Access-Control-Allow-Methods", RespHeaders),
?SUPPORTED_METHODS,
"Access-Control-Allow-Methods ok");
@@ -151,7 +151,7 @@ test_db_request() ->
test_db_preflight_request() ->
Url = server() ++ "etap-test-db",
- Headers = [{"Origin", "http://127.0.0.1"},
+ Headers = [{"Origin", "http://127.0.0.1"},
{"Access-Control-Request-Method", "GET"}],
case ibrowse:send_req(Url, Headers, options, []) of
{ok, _, RespHeaders, _} ->
@@ -203,7 +203,7 @@ test_db1_wrong_origin_request() ->
test_db_preflight_auth_request() ->
Url = server() ++ "etap-test-db2",
- Headers = [{"Origin", "http://127.0.0.1"},
+ Headers = [{"Origin", "http://127.0.0.1"},
{"Access-Control-Request-Method", "GET"}],
case ibrowse:send_req(Url, Headers, options, []) of
{ok, _Status, RespHeaders, _} ->
@@ -222,7 +222,7 @@ test_db_origin_auth_request() ->
Headers = [{"Origin", "http://127.0.0.1"}],
Url = server() ++ "etap-test-db2",
- case ibrowse:send_req(Url, Headers, get, [],
+ case ibrowse:send_req(Url, Headers, get, [],
[{basic_auth, {"test", "test"}}]) of
{ok, _, RespHeaders, _Body} ->
etap:is(proplists:get_value("Access-Control-Allow-Origin", RespHeaders),
3  test/etap/Makefile.am
View
@@ -93,4 +93,5 @@ EXTRA_DIST = \
230-httpc-pool.t \
240-replication-compact.t \
241-replication-large-atts.t \
- 242-replication-many-leaves.t
+ 242-replication-many-leaves.t \
+ 250-cors.t
Please sign in to comment.
Something went wrong with that request. Please try again.