couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [30/44] git commit: simplify test logic
Date Tue, 04 Dec 2012 20:43:49 GMT
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/1368-fix-multipart-header-parts
Commit: 789d26c9e3363a060956d1eeeeebe8def5c97f78
Parents: b8d189f
Author: Jan Lehnardt <jan@apache.org>
Authored: Thu Nov 8 16:45:06 2012 +0100
Committer: Jan Lehnardt <jan@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(),


Mime
View raw message