Make tests great again !
(Also use only one field for public/private key pem) Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -23,6 +23,13 @@ defmodule EventosWeb.ConnCase do
|
||||
|
||||
# The default endpoint for testing
|
||||
@endpoint EventosWeb.Endpoint
|
||||
|
||||
def auth_conn(%Plug.Conn{} = conn, %Eventos.Actors.User{} = user) do
|
||||
{:ok, token, _claims} = EventosWeb.Guardian.encode_and_sign(user)
|
||||
conn
|
||||
|> Plug.Conn.put_req_header("authorization", "Bearer #{token}")
|
||||
|> Plug.Conn.put_req_header("accept", "application/json")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user