Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
991B

  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Plugs.UserEnabledPlugTest do
  5. use Pleroma.Web.ConnCase, async: true
  6. alias Pleroma.Plugs.UserEnabledPlug
  7. import Pleroma.Factory
  8. test "doesn't do anything if the user isn't set", %{conn: conn} do
  9. ret_conn =
  10. conn
  11. |> UserEnabledPlug.call(%{})
  12. assert ret_conn == conn
  13. end
  14. test "with a user that is deactivated, it removes that user", %{conn: conn} do
  15. user = insert(:user, deactivated: true)
  16. conn =
  17. conn
  18. |> assign(:user, user)
  19. |> UserEnabledPlug.call(%{})
  20. assert conn.assigns.user == nil
  21. end
  22. test "with a user that is not deactivated, it does nothing", %{conn: conn} do
  23. user = insert(:user)
  24. conn =
  25. conn
  26. |> assign(:user, user)
  27. ret_conn =
  28. conn
  29. |> UserEnabledPlug.call(%{})
  30. assert conn == ret_conn
  31. end
  32. end