1
0
Fork 1
mirror of https://akkoma.dev/AkkomaGang/akkoma.git synced 2024-11-19 03:19:17 +00:00
akkoma/test/plugs/ensure_authenticated_plug_test.exs
2018-09-05 17:59:19 +02:00

28 lines
582 B
Elixir

defmodule Pleroma.Plugs.EnsureAuthenticatedPlugTest do
use Pleroma.Web.ConnCase, async: true
alias Pleroma.Plugs.EnsureAuthenticatedPlug
alias Pleroma.User
test "it halts if no user is assigned", %{conn: conn} do
conn =
conn
|> EnsureAuthenticatedPlug.call(%{})
assert conn.status == 403
assert conn.halted == true
end
test "it continues if a user is assigned", %{conn: conn} do
conn =
conn
|> assign(:user, %User{})
ret_conn =
conn
|> EnsureAuthenticatedPlug.call(%{})
assert ret_conn == conn
end
end