Add the helper to make a user log in.
This commit is contained in:
@@ -40,4 +40,15 @@ defmodule DecentralisedBookIndex.Helpers do
|
|||||||
|> DateTime.add(seconds)
|
|> DateTime.add(seconds)
|
||||||
|> DateTime.to_iso8601()
|
|> DateTime.to_iso8601()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Logs the given `user` into the `conn`.
|
||||||
|
|
||||||
|
It returns an updated `conn`.
|
||||||
|
"""
|
||||||
|
def log_in_user(conn, user) do
|
||||||
|
conn
|
||||||
|
|> Phoenix.ConnTest.init_test_session(%{})
|
||||||
|
|> AshAuthentication.Plug.Helpers.store_in_session(user)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user