Replies: 2 comments
-
Have you tried using |
Beta Was this translation helpful? Give feedback.
0 replies
-
@paulswartz thank you for you answer, I've made this inside test test "logs in on success auth", %{conn: conn, auth: auth} do
conn =
conn
|> bypass_through(RootWeb.Router, [:browser])
|> assign(:ueberauth_auth, auth)
|> get("/auth/auth0/callback")
|> RootWeb.Auth.Controller.callback(%{})
assert get_flash(conn, :info) == "Successfully authenticated as #{auth.info.name}."
assert redirected_to(conn) == ~p"/profile"
assert conn |> get(~p"/") |> get_session(:current_user) == %{
uid: auth.uid,
email: auth.info.email
}
end and inside conn_case @session_opts Plug.Session.init(
store: :cookie,
key: "_session",
encryption_salt: "encrypted cookie salt",
signing_salt: "signing salt",
secret_key_base: String.duplicate("abcdef0123456789", 8),
same_site: "Lax"
)
setup tags do
Root.DataCase.setup_sandbox(tags)
conn =
Phoenix.ConnTest.build_conn()
|> Plug.Session.call(@session_opts)
|> Plug.Conn.fetch_session()
|> Phoenix.Controller.fetch_flash()
{:ok, conn: conn}
end |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! could you explain how to test ueberauth callbacks?
I have looked at examples in your repository, found some examples in the issue (ueberauth/ueberauth_example#22), but in the test environment I receive
controller.ex
controller_test.exs
Beta Was this translation helpful? Give feedback.
All reactions