diff options
Diffstat (limited to 'test/web/activity_pub/mrf')
10 files changed, 25 insertions, 28 deletions
| diff --git a/test/web/activity_pub/mrf/hellthread_policy_test.exs b/test/web/activity_pub/mrf/hellthread_policy_test.exs index 916b95692..95ef0b168 100644 --- a/test/web/activity_pub/mrf/hellthread_policy_test.exs +++ b/test/web/activity_pub/mrf/hellthread_policy_test.exs @@ -26,7 +26,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicyTest do      [user: user, message: message]    end -  clear_config(:mrf_hellthread) +  setup do: clear_config(:mrf_hellthread)    describe "reject" do      test "rejects the message if the recipient count is above reject_threshold", %{ diff --git a/test/web/activity_pub/mrf/keyword_policy_test.exs b/test/web/activity_pub/mrf/keyword_policy_test.exs index 18242a889..fd1f7aec8 100644 --- a/test/web/activity_pub/mrf/keyword_policy_test.exs +++ b/test/web/activity_pub/mrf/keyword_policy_test.exs @@ -7,7 +7,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.KeywordPolicyTest do    alias Pleroma.Web.ActivityPub.MRF.KeywordPolicy -  clear_config(:mrf_keyword) +  setup do: clear_config(:mrf_keyword)    setup do      Pleroma.Config.put([:mrf_keyword], %{reject: [], federated_timeline_removal: [], replace: []}) diff --git a/test/web/activity_pub/mrf/mention_policy_test.exs b/test/web/activity_pub/mrf/mention_policy_test.exs index 08f7be542..aa003bef5 100644 --- a/test/web/activity_pub/mrf/mention_policy_test.exs +++ b/test/web/activity_pub/mrf/mention_policy_test.exs @@ -7,7 +7,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.MentionPolicyTest do    alias Pleroma.Web.ActivityPub.MRF.MentionPolicy -  clear_config(:mrf_mention) +  setup do: clear_config(:mrf_mention)    test "pass filter if allow list is empty" do      Pleroma.Config.delete([:mrf_mention]) diff --git a/test/web/activity_pub/mrf/mrf_test.exs b/test/web/activity_pub/mrf/mrf_test.exs index 04709df17..c941066f2 100644 --- a/test/web/activity_pub/mrf/mrf_test.exs +++ b/test/web/activity_pub/mrf/mrf_test.exs @@ -60,7 +60,7 @@ defmodule Pleroma.Web.ActivityPub.MRFTest do    end    describe "describe/0" do -    clear_config([:instance, :rewrite_policy]) +    setup do: clear_config([:instance, :rewrite_policy])      test "it works as expected with noop policy" do        expected = %{ diff --git a/test/web/activity_pub/mrf/object_age_policy_test.exs b/test/web/activity_pub/mrf/object_age_policy_test.exs index 643609da4..0fbc5f57a 100644 --- a/test/web/activity_pub/mrf/object_age_policy_test.exs +++ b/test/web/activity_pub/mrf/object_age_policy_test.exs @@ -9,12 +9,11 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do    alias Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy    alias Pleroma.Web.ActivityPub.Visibility -  clear_config([:mrf_object_age]) do -    Config.put(:mrf_object_age, -      threshold: 172_800, -      actions: [:delist, :strip_followers] -    ) -  end +  setup do: +          clear_config(:mrf_object_age, +            threshold: 172_800, +            actions: [:delist, :strip_followers] +          )    setup_all do      Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end) diff --git a/test/web/activity_pub/mrf/reject_non_public_test.exs b/test/web/activity_pub/mrf/reject_non_public_test.exs index fc1d190bb..abfd32df8 100644 --- a/test/web/activity_pub/mrf/reject_non_public_test.exs +++ b/test/web/activity_pub/mrf/reject_non_public_test.exs @@ -8,7 +8,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.RejectNonPublicTest do    alias Pleroma.Web.ActivityPub.MRF.RejectNonPublic -  clear_config([:mrf_rejectnonpublic]) +  setup do: clear_config([:mrf_rejectnonpublic])    describe "public message" do      test "it's allowed when address is public" do diff --git a/test/web/activity_pub/mrf/simple_policy_test.exs b/test/web/activity_pub/mrf/simple_policy_test.exs index df0f223f8..5aebbc675 100644 --- a/test/web/activity_pub/mrf/simple_policy_test.exs +++ b/test/web/activity_pub/mrf/simple_policy_test.exs @@ -8,18 +8,17 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicyTest do    alias Pleroma.Config    alias Pleroma.Web.ActivityPub.MRF.SimplePolicy -  clear_config([:mrf_simple]) do -    Config.put(:mrf_simple, -      media_removal: [], -      media_nsfw: [], -      federated_timeline_removal: [], -      report_removal: [], -      reject: [], -      accept: [], -      avatar_removal: [], -      banner_removal: [] -    ) -  end +  setup do: +          clear_config(:mrf_simple, +            media_removal: [], +            media_nsfw: [], +            federated_timeline_removal: [], +            report_removal: [], +            reject: [], +            accept: [], +            avatar_removal: [], +            banner_removal: [] +          )    describe "when :media_removal" do      test "is empty" do diff --git a/test/web/activity_pub/mrf/subchain_policy_test.exs b/test/web/activity_pub/mrf/subchain_policy_test.exs index 221b8958e..fff66cb7e 100644 --- a/test/web/activity_pub/mrf/subchain_policy_test.exs +++ b/test/web/activity_pub/mrf/subchain_policy_test.exs @@ -13,8 +13,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.SubchainPolicyTest do      "type" => "Create",      "object" => %{"content" => "hi"}    } - -  clear_config([:mrf_subchain, :match_actor]) +  setup do: clear_config([:mrf_subchain, :match_actor])    test "it matches and processes subchains when the actor matches a configured target" do      Pleroma.Config.put([:mrf_subchain, :match_actor], %{ diff --git a/test/web/activity_pub/mrf/user_allowlist_policy_test.exs b/test/web/activity_pub/mrf/user_allowlist_policy_test.exs index 87c9e1b29..724bae058 100644 --- a/test/web/activity_pub/mrf/user_allowlist_policy_test.exs +++ b/test/web/activity_pub/mrf/user_allowlist_policy_test.exs @@ -7,7 +7,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.UserAllowListPolicyTest do    alias Pleroma.Web.ActivityPub.MRF.UserAllowListPolicy -  clear_config([:mrf_user_allowlist, :localhost]) +  setup do: clear_config([:mrf_user_allowlist, :localhost])    test "pass filter if allow list is empty" do      actor = insert(:user) diff --git a/test/web/activity_pub/mrf/vocabulary_policy_test.exs b/test/web/activity_pub/mrf/vocabulary_policy_test.exs index d9207b095..69f22bb77 100644 --- a/test/web/activity_pub/mrf/vocabulary_policy_test.exs +++ b/test/web/activity_pub/mrf/vocabulary_policy_test.exs @@ -8,7 +8,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do    alias Pleroma.Web.ActivityPub.MRF.VocabularyPolicy    describe "accept" do -    clear_config([:mrf_vocabulary, :accept]) +    setup do: clear_config([:mrf_vocabulary, :accept])      test "it accepts based on parent activity type" do        Pleroma.Config.put([:mrf_vocabulary, :accept], ["Like"]) @@ -65,7 +65,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do    end    describe "reject" do -    clear_config([:mrf_vocabulary, :reject]) +    setup do: clear_config([:mrf_vocabulary, :reject])      test "it rejects based on parent activity type" do        Pleroma.Config.put([:mrf_vocabulary, :reject], ["Like"]) | 
