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 2018/03/28 16:43:42 UTC

[couchdb] branch master updated: add test covering loading admins from config

This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/master by this push:
     new f6fc285  add test covering loading admins from config
f6fc285 is described below

commit f6fc28560680e513c06d2c763ce350e3b35bf912
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Wed Mar 28 12:33:40 2018 +0200

    add test covering loading admins from config
---
 src/couch/test/couch_auth_cache_tests.erl | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/couch/test/couch_auth_cache_tests.erl b/src/couch/test/couch_auth_cache_tests.erl
index 6916045..706c0ce 100644
--- a/src/couch/test/couch_auth_cache_tests.erl
+++ b/src/couch/test/couch_auth_cache_tests.erl
@@ -52,7 +52,8 @@ couch_auth_cache_test_() ->
                     fun should_drop_cache_on_auth_db_change/1,
                     fun should_restore_cache_on_auth_db_change/1,
                     fun should_recover_cache_after_shutdown/1,
-                    fun should_close_old_db_on_auth_db_change/1
+                    fun should_close_old_db_on_auth_db_change/1,
+                    fun should_get_admin_from_config/1
                 ]
             }
         }
@@ -237,6 +238,19 @@ should_close_old_db_on_auth_db_change(DbName) ->
         ?assertEqual(ok, wait_db(DbName, fun is_closed/1))
     end)}.
 
+should_get_admin_from_config(_DbName) ->
+    ?_test(begin
+        config:set("admins", "testadmin", "password", false),
+        Creds = test_util:wait(fun() ->
+            case couch_auth_cache:get_user_creds("testadmin") of
+                {ok, Creds0, _} -> Creds0;
+                nil -> wait
+            end
+        end),
+        Roles = couch_util:get_value(<<"roles">>, Creds),
+        ?assertEqual([<<"_admin">>], Roles)
+    end).
+
 update_user_doc(DbName, UserName, Password) ->
     update_user_doc(DbName, UserName, Password, nil).
 

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.