Merge branch 'feature/pleromafe-usersearch' into 'develop'
[akkoma] / test / plugs / ensure_user_key_plug_test.exs
1 defmodule Pleroma.Plugs.EnsureUserKeyPlugTest do
2 use Pleroma.Web.ConnCase, async: true
3
4 alias Pleroma.Plugs.EnsureUserKeyPlug
5
6 test "if the conn has a user key set, it does nothing", %{conn: conn} do
7 conn =
8 conn
9 |> assign(:user, 1)
10
11 ret_conn =
12 conn
13 |> EnsureUserKeyPlug.call(%{})
14
15 assert conn == ret_conn
16 end
17
18 test "if the conn has no key set, it sets it to nil", %{conn: conn} do
19 conn =
20 conn
21 |> EnsureUserKeyPlug.call(%{})
22
23 assert Map.has_key?(conn.assigns, :user)
24 end
25 end