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.UserEnabledPlugTest do
6 use Pleroma.Web.ConnCase, async: true
8 alias Pleroma.Plugs.UserEnabledPlug
11 test "doesn't do anything if the user isn't set", %{conn: conn} do
14 |> UserEnabledPlug.call(%{})
16 assert ret_conn == conn
19 test "with a user that is deactivated, it removes that user", %{conn: conn} do
20 user = insert(:user, info: %{deactivated: true})
24 |> assign(:user, user)
25 |> UserEnabledPlug.call(%{})
27 assert conn.assigns.user == nil
30 test "with a user that is not deactivated, it does nothing", %{conn: conn} do
35 |> assign(:user, user)
39 |> UserEnabledPlug.call(%{})
41 assert conn == ret_conn