You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2012/11/08 17:05:45 UTC

git commit: simplify test logic

Updated Branches:
  refs/heads/431-feature_cors b8d189fd2 -> 789d26c9e


simplify test logic


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/789d26c9
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/789d26c9
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/789d26c9

Branch: refs/heads/431-feature_cors
Commit: 789d26c9e3363a060956d1eeeeebe8def5c97f78
Parents: b8d189f
Author: Jan Lehnardt <ja...@apache.org>
Authored: Thu Nov 8 16:45:06 2012 +0100
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Thu Nov 8 16:45:06 2012 +0100

----------------------------------------------------------------------
 test/etap/231-cors.t |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/789d26c9/test/etap/231-cors.t
----------------------------------------------------------------------
diff --git a/test/etap/231-cors.t b/test/etap/231-cors.t
index 75cae6b..3debb6b 100644
--- a/test/etap/231-cors.t
+++ b/test/etap/231-cors.t
@@ -54,6 +54,11 @@ set_admin_password(UserName, Password) ->
     couch_config:set("admins", UserName,
         "-hashed-" ++ Hashed ++ "," ++ Salt, false).
 
+cycle_db(DbName) ->
+    couch_server:delete(list_to_binary(DbName), [admin_user_ctx()]),
+    {ok, Db} = couch_db:create(list_to_binary(DbName), [admin_user_ctx()]),
+    Db.
+
 test() ->
 
     ibrowse:start(),
@@ -64,12 +69,9 @@ test() ->
 
     %% initialize db
     timer:sleep(1000),
-    couch_server:delete(list_to_binary(dbname()), [admin_user_ctx()]),
-    couch_server:delete(list_to_binary(dbname1()), [admin_user_ctx()]),
-    couch_server:delete(list_to_binary(dbname2()), [admin_user_ctx()]),
-    {ok, Db} = couch_db:create(list_to_binary(dbname()), [admin_user_ctx()]),
-    {ok, Db1} = couch_db:create(list_to_binary(dbname1()), [admin_user_ctx()]),
-    {ok, Db2} = couch_db:create(list_to_binary(dbname2()), [admin_user_ctx()]),
+    Db = cycle_db(dbname()),
+    Db1 = cycle_db(dbname1()),
+    Db2 = cycle_db(dbname2()),
 
     % CORS is disabled by default
     test_no_headers_server(),