X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fplugs%2Fensure_public_or_authenticated_plug_test.exs;h=bae95e15077e29f1676e14ba0fd550a3bb841f14;hb=70c7a26de8135ddc089fc0d2e0766e2e793d505c;hp=ce5d77ff7e1a973a0b7b68e6da83ab1abac4c70f;hpb=412a3d8a0f74ee3a46f9ba98d906c65c6c1c4da8;p=akkoma
diff --git a/test/plugs/ensure_public_or_authenticated_plug_test.exs b/test/plugs/ensure_public_or_authenticated_plug_test.exs
index ce5d77ff7..bae95e150 100644
--- a/test/plugs/ensure_public_or_authenticated_plug_test.exs
+++ b/test/plugs/ensure_public_or_authenticated_plug_test.exs
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2018 Pleroma Authors
+# Copyright © 2017-2019 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Plugs.EnsurePublicOrAuthenticatedPlugTest do
@@ -9,8 +9,10 @@ defmodule Pleroma.Plugs.EnsurePublicOrAuthenticatedPlugTest do
alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug
alias Pleroma.User
+ clear_config([:instance, :public])
+
test "it halts if not public and no user is assigned", %{conn: conn} do
- set_public_to(false)
+ Config.put([:instance, :public], false)
conn =
conn
@@ -21,7 +23,7 @@ defmodule Pleroma.Plugs.EnsurePublicOrAuthenticatedPlugTest do
end
test "it continues if public", %{conn: conn} do
- set_public_to(true)
+ Config.put([:instance, :public], true)
ret_conn =
conn
@@ -31,7 +33,7 @@ defmodule Pleroma.Plugs.EnsurePublicOrAuthenticatedPlugTest do
end
test "it continues if a user is assigned, even if not public", %{conn: conn} do
- set_public_to(false)
+ Config.put([:instance, :public], false)
conn =
conn
@@ -43,13 +45,4 @@ defmodule Pleroma.Plugs.EnsurePublicOrAuthenticatedPlugTest do
assert ret_conn == conn
end
-
- defp set_public_to(value) do
- orig = Config.get!([:instance, :public])
- Config.put([:instance, :public], value)
-
- on_exit(fn ->
- Config.put([:instance, :public], orig)
- end)
- end
end