You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2015/11/24 21:37:14 UTC
[3/4] couch commit: updated refs/heads/master to c38ab6b
Simplify, and remove unnecessary code
COUCHDB-2898
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/bc071d7b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/bc071d7b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/bc071d7b
Branch: refs/heads/master
Commit: bc071d7b47e11c59f44d0b791ac472c94919839c
Parents: 5df9515
Author: Jay Doane <ja...@gmail.com>
Authored: Sun Nov 22 14:03:34 2015 -0800
Committer: Jay Doane <ja...@gmail.com>
Committed: Sun Nov 22 14:03:34 2015 -0800
----------------------------------------------------------------------
test/global_changes_tests.erl | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/bc071d7b/test/global_changes_tests.erl
----------------------------------------------------------------------
diff --git a/test/global_changes_tests.erl b/test/global_changes_tests.erl
index 6054128..930b985 100644
--- a/test/global_changes_tests.erl
+++ b/test/global_changes_tests.erl
@@ -85,7 +85,7 @@ check_response() ->
should_return_correct_response_on_create({Host, DbName}) ->
?_test(begin
- Headers = [{basic_auth, {"admin", "pass"}}],
+ Headers = [?AUTH],
create_doc(Host, DbName, "bar/baz"),
{Status, Events} = request_updates(Host, DbName, Headers),
?assertEqual(200, Status),
@@ -94,7 +94,7 @@ should_return_correct_response_on_create({Host, DbName}) ->
should_return_correct_response_on_update({Host, DbName}) ->
?_test(begin
- Headers = [{basic_auth, {"admin", "pass"}}],
+ Headers = [?AUTH],
create_doc(Host, DbName, "bar/baz"),
update_doc(Host, DbName, "bar/baz", "new_value"),
{Status, Events} = request_updates(Host, DbName, Headers),
@@ -103,7 +103,7 @@ should_return_correct_response_on_update({Host, DbName}) ->
end).
create_doc(Host, DbName, Id) ->
- Headers = [{basic_auth, {"admin", "pass"}}],
+ Headers = [?AUTH],
Url = Host ++ "/" ++ escape(DbName) ++ "/" ++ escape(Id),
Body = jiffy:encode({[
{key, "value"}
@@ -114,7 +114,7 @@ create_doc(Host, DbName, Id) ->
ok.
update_doc(Host, DbName, Id, Value) ->
- Headers = [{basic_auth, {"admin", "pass"}}],
+ Headers = [?AUTH],
Url = Host ++ "/" ++ escape(DbName) ++ "/" ++ escape(Id),
{ok, 200, _Headers0, BinBody} = test_request:get(Url, Headers),
[Rev] = decode_response(BinBody, [<<"_rev">>]),
@@ -144,8 +144,7 @@ decode_response(BinBody, ToDecode) ->
[couch_util:get_value(Key, Body) || Key <- ToDecode].
add_admin(User, Pass) ->
- Hashed = couch_passwords:hash_admin_password(Pass),
- config:set("admins", User, ?b2l(Hashed), false).
+ config:set("admins", User, Pass, false).
delete_admin(User) ->
config:delete("admins", User, false).
@@ -153,8 +152,7 @@ delete_admin(User) ->
get_host() ->
Addr = config:get("httpd", "bind_address", "127.0.0.1"),
Port = integer_to_list(mochiweb_socket_server:get(chttpd, port)),
- Host = "http://" ++ Addr ++ ":" ++ Port,
- Host.
+ "http://" ++ Addr ++ ":" ++ Port.
escape(Path) ->
re:replace(Path, "/", "%2f", [global, {return, list}]).