X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fplugs%2Fuser_enabled_plug_test.exs;h=b219d8abffa35f759470dccedbefbba9ceddb7f6;hb=a2f9bc77b6514327bee11bac3090d935f0e570b4;hp=c0fafcab1fec842985234f55cdbdddb91c9ce982;hpb=627e5a0a4992cc19fc65a7e93a09c470c8e2bf33;p=akkoma
diff --git a/test/plugs/user_enabled_plug_test.exs b/test/plugs/user_enabled_plug_test.exs
index c0fafcab1..b219d8abf 100644
--- a/test/plugs/user_enabled_plug_test.exs
+++ b/test/plugs/user_enabled_plug_test.exs
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2018 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Plugs.UserEnabledPlugTest do
@@ -8,6 +8,8 @@ defmodule Pleroma.Plugs.UserEnabledPlugTest do
alias Pleroma.Plugs.UserEnabledPlug
import Pleroma.Factory
+ setup do: clear_config([:instance, :account_activation_required])
+
test "doesn't do anything if the user isn't set", %{conn: conn} do
ret_conn =
conn
@@ -16,8 +18,22 @@ defmodule Pleroma.Plugs.UserEnabledPlugTest do
assert ret_conn == conn
end
+ test "with a user that's not confirmed and a config requiring confirmation, it removes that user",
+ %{conn: conn} do
+ Pleroma.Config.put([:instance, :account_activation_required], true)
+
+ user = insert(:user, confirmation_pending: true)
+
+ conn =
+ conn
+ |> assign(:user, user)
+ |> UserEnabledPlug.call(%{})
+
+ assert conn.assigns.user == nil
+ end
+
test "with a user that is deactivated, it removes that user", %{conn: conn} do
- user = insert(:user, info: %{deactivated: true})
+ user = insert(:user, deactivated: true)
conn =
conn