iilyak commented on a change in pull request #2007: Port javascript tests auth 
cache, cookie auth and users db to elixir
URL: https://github.com/apache/couchdb/pull/2007#discussion_r295941707
 
 

 ##########
 File path: test/elixir/test/cookie_auth_test.exs
 ##########
 @@ -0,0 +1,415 @@
+defmodule CookieAuthTest do
+  use CouchTestCase
+
+  @moduletag :authentication
+
+  @users_db "_users"
+
+  @password "3.141592653589"
+
+  test "test cookie auth" do
+    # Create db if not exists
+    Couch.put("/#{@users_db}")
+
+    server_config = [
+      %{
+        :section => "chttpd_auth",
+        :key => "authentication_db",
+        :value => @users_db
+      },
+      %{
+        :section => "couch_httpd_auth",
+        :key => "authentication_db",
+        :value => @users_db
+      },
+      %{
+        :section => "couch_httpd_auth",
+        :key => "iterations",
+        :value => "1"
+      },
+      %{
+        :section => "admins",
+        :key => "jan",
+        :value => "apple"
+      }
+    ]
+
+    resp =
+      Couch.get(
+        "/#{@users_db}/_changes",
+        query: [feed: "longpoll", timeout: 5000, filter: "_design"]
+      )
+
+    assert resp.body
+
+    run_on_modified_server(server_config, &test_fun/0)
+  end
+
+  defp login(user, password) do
+    sess = Couch.login(user, password)
+    assert sess.cookie, "Login correct is expected"
+    sess
+  end
+
+  defp logout(session) do
+    assert Couch.Session.logout(session).body["ok"]
+  end
+
+  defp loginAsUser(user) do
 
 Review comment:
   I think this function should be named  `login_as_user` or `login_as` (to 
match with `open_as`).

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


With regards,
Apache Git Services

Reply via email to