You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/03/28 16:43:40 UTC

[GitHub] janl closed pull request #1249: add test covering loading admins from config

janl closed pull request #1249: add test covering loading admins from config
URL: https://github.com/apache/couchdb/pull/1249
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/couch/test/couch_auth_cache_tests.erl b/src/couch/test/couch_auth_cache_tests.erl
index 6916045c35..706c0cee96 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).
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services