1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.Plugs.UserFetcherPlugTest do
6 use Pleroma.Web.ConnCase, async: true
8 alias Pleroma.Web.Plugs.UserFetcherPlug
16 test "if an auth_credentials assign is present, it tries to fetch the user and assigns it", %{
22 |> assign(:auth_credentials, %{
23 username: user.nickname,
29 |> UserFetcherPlug.call(%{})
31 assert conn.assigns[:auth_user] == user
34 test "without a credential assign it doesn't do anything", %{conn: conn} do
37 |> UserFetcherPlug.call(%{})
39 assert conn == ret_conn