Skip to content

Commit 086e519

Browse files
author
Adrián Quintás
committed
Missing module fix
1 parent 517d9d6 commit 086e519

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/auth_conn_case.ex

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,22 @@ defmodule JwtTestUtils.AuthConnCase do
1010
@fake_user_id "user@fake.is"
1111
@auth_header "authorization"
1212

13+
alias JwtTestUtils.JwtMocker
14+
1315
@doc """
1416
Returns a Plug.Conn with a injected header with a JWT token injected.
1517
1618
By default returns always the same token in the "authorization" header.
1719
"""
18-
@spec get_claim(String.t(), String.t()) :: {Plug.Conn.t()}
20+
@spec build_authed_conn(String.t(), String.t()) :: {Plug.Conn.t()}
1921
def build_authed_conn(user_id \\ @fake_user_id, auth_header \\ @auth_header) do
2022
jwt = JwtMocker.generate_json_token(user_id)
21-
conn = Plug.Adapters.Test.Conn.conn(%Conn{}, :get, "/", nil)
23+
24+
conn =
25+
Plug.Adapters.Test.Conn.conn(%Plug.Conn{}, :get, "/", nil)
26+
|> Plug.Conn.put_private(:plug_skip_csrf_protection, true)
27+
|> Plug.Conn.put_private(:phoenix_recycled, true)
28+
2229
Plug.Conn.put_req_header(conn, auth_header, jwt)
2330
end
2431
end

0 commit comments

Comments
 (0)