Merge branch 'develop' into feature/reports-groups-and-multiple-state-update
[akkoma] / test / web / activity_pub / mrf / vocabulary_policy_test.exs
index c3b11d7a14543dd4b03fdcbbd43790a25a101e7d..38309f9f1f3ee4926bc141020d61be18c3d581de 100644 (file)
@@ -8,8 +8,9 @@ defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
   alias Pleroma.Web.ActivityPub.MRF.VocabularyPolicy
 
   describe "accept" do
+    clear_config([:mrf_vocabulary, :accept])
+
     test "it accepts based on parent activity type" do
-      config = Pleroma.Config.get([:mrf_vocabulary, :accept])
       Pleroma.Config.put([:mrf_vocabulary, :accept], ["Like"])
 
       message = %{
@@ -18,12 +19,9 @@ defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
       }
 
       {:ok, ^message} = VocabularyPolicy.filter(message)
-
-      Pleroma.Config.put([:mrf_vocabulary, :accept], config)
     end
 
     test "it accepts based on child object type" do
-      config = Pleroma.Config.get([:mrf_vocabulary, :accept])
       Pleroma.Config.put([:mrf_vocabulary, :accept], ["Create", "Note"])
 
       message = %{
@@ -35,12 +33,9 @@ defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
       }
 
       {:ok, ^message} = VocabularyPolicy.filter(message)
-
-      Pleroma.Config.put([:mrf_vocabulary, :accept], config)
     end
 
     test "it does not accept disallowed child objects" do
-      config = Pleroma.Config.get([:mrf_vocabulary, :accept])
       Pleroma.Config.put([:mrf_vocabulary, :accept], ["Create", "Note"])
 
       message = %{
@@ -52,12 +47,9 @@ defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
       }
 
       {:reject, nil} = VocabularyPolicy.filter(message)
-
-      Pleroma.Config.put([:mrf_vocabulary, :accept], config)
     end
 
     test "it does not accept disallowed parent types" do
-      config = Pleroma.Config.get([:mrf_vocabulary, :accept])
       Pleroma.Config.put([:mrf_vocabulary, :accept], ["Announce", "Note"])
 
       message = %{
@@ -69,14 +61,13 @@ defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
       }
 
       {:reject, nil} = VocabularyPolicy.filter(message)
-
-      Pleroma.Config.put([:mrf_vocabulary, :accept], config)
     end
   end
 
   describe "reject" do
+    clear_config([:mrf_vocabulary, :reject])
+
     test "it rejects based on parent activity type" do
-      config = Pleroma.Config.get([:mrf_vocabulary, :reject])
       Pleroma.Config.put([:mrf_vocabulary, :reject], ["Like"])
 
       message = %{
@@ -85,12 +76,9 @@ defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
       }
 
       {:reject, nil} = VocabularyPolicy.filter(message)
-
-      Pleroma.Config.put([:mrf_vocabulary, :reject], config)
     end
 
     test "it rejects based on child object type" do
-      config = Pleroma.Config.get([:mrf_vocabulary, :reject])
       Pleroma.Config.put([:mrf_vocabulary, :reject], ["Note"])
 
       message = %{
@@ -102,12 +90,9 @@ defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
       }
 
       {:reject, nil} = VocabularyPolicy.filter(message)
-
-      Pleroma.Config.put([:mrf_vocabulary, :reject], config)
     end
 
     test "it passes through objects that aren't disallowed" do
-      config = Pleroma.Config.get([:mrf_vocabulary, :reject])
       Pleroma.Config.put([:mrf_vocabulary, :reject], ["Like"])
 
       message = %{
@@ -116,8 +101,6 @@ defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do
       }
 
       {:ok, ^message} = VocabularyPolicy.filter(message)
-
-      Pleroma.Config.put([:mrf_vocabulary, :reject], config)
     end
   end
 end