couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [1/4] couch commit: updated refs/heads/master to c38ab6b
Date Tue, 24 Nov 2015 20:37:12 GMT
Repository: couchdb-couch
Updated Branches:
  refs/heads/master 5e81713f4 -> c38ab6b2d


Create and delete test db using HTTP API

This supports downstream name munging that might occur

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/c7ecd2b4
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/c7ecd2b4
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/c7ecd2b4

Branch: refs/heads/master
Commit: c7ecd2b46601ce83177be333252f7a62aa5277ff
Parents: a5aa4e1
Author: Jay Doane <jay.s.doane@gmail.com>
Authored: Sun Nov 22 10:56:44 2015 -0800
Committer: Jay Doane <jay.s.doane@gmail.com>
Committed: Sun Nov 22 10:56:44 2015 -0800

----------------------------------------------------------------------
 test/global_changes_tests.erl | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/c7ecd2b4/test/global_changes_tests.erl
----------------------------------------------------------------------
diff --git a/test/global_changes_tests.erl b/test/global_changes_tests.erl
index e04f3bf..a37a524 100644
--- a/test/global_changes_tests.erl
+++ b/test/global_changes_tests.erl
@@ -15,19 +15,38 @@
 -include_lib("couch/include/couch_eunit.hrl").
 -include_lib("couch/include/couch_db.hrl").
 
+-define(USER, "admin").
+-define(PASS, "pass").
+-define(AUTH, {basic_auth, {?USER, ?PASS}}).
+
 setup() ->
     Host = get_host(),
-    add_admin("admin", <<"pass">>),
+    ok = add_admin(?USER, ?PASS),
     DbName = "foo/" ++ ?b2l(?tempdb()),
     [fabric:create_db(Name, [?ADMIN_CTX])
         || Name <- ["_global_changes", DbName]],
+    ok = http_create_db(DbName),
     {Host, DbName}.
 
 teardown({_, DbName}) ->
-    delete_admin("admin"),
     [fabric:delete_db(Name, [?ADMIN_CTX])
         || Name <- ["_global_changes", DbName]],
+    ok = http_delete_db(DbName),
+    delete_admin(?USER),
+    ok.
+
+http_create_db(Name) ->
+    Resp = {ok, Status, _, _} = test_request:put(db_url(Name), [?AUTH], ""),
+    true = lists:member(Status, [201, 202]),
     ok.
+    
+http_delete_db(Name) ->
+    {ok, Status, _, _} = test_request:delete(db_url(Name), [?AUTH]),
+    true = lists:member(Status, [200, 202]),
+    ok.
+
+db_url(Name) ->
+    get_host() ++ "/" ++ escape(Name).
 
 global_changes_test_() ->
     {


Mime
View raw message