1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Plugs.EnsureUserKeyPlugTest do
6 use Pleroma.Web.ConnCase, async: true
8 alias Pleroma.Plugs.EnsureUserKeyPlug
10 test "if the conn has a user key set, it does nothing", %{conn: conn} do
17 |> EnsureUserKeyPlug.call(%{})
19 assert conn == ret_conn
22 test "if the conn has no key set, it sets it to nil", %{conn: conn} do
25 |> EnsureUserKeyPlug.call(%{})
27 assert Map.has_key?(conn.assigns, :user)