diff options
Diffstat (limited to 'test/pleroma/web')
-rw-r--r-- | test/pleroma/web/activity_pub/mrf_test.exs | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/test/pleroma/web/activity_pub/mrf_test.exs b/test/pleroma/web/activity_pub/mrf_test.exs index fd88435ff..e9c31ba24 100644 --- a/test/pleroma/web/activity_pub/mrf_test.exs +++ b/test/pleroma/web/activity_pub/mrf_test.exs @@ -79,9 +79,18 @@ defmodule Pleroma.Web.ActivityPub.MRFTest do end end + describe "normalize_instance_list/1" do + test "returns a list of tuples" do + list = [{"some.tld", "a reason"}, "other.tld"] + expected = [{"some.tld", "a reason"}, {"other.tld", ""}] + + assert MRF.normalize_instance_list(list) == expected + end + end + describe "describe/0" do test "it works as expected with noop policy" do - clear_config([:mrf, :policies], [Pleroma.Web.ActivityPub.MRF.NoOpPolicy]) + clear_config([:mrf, :policies], [MRF.NoOpPolicy]) expected = %{ mrf_policies: ["NoOpPolicy", "HashtagPolicy"], @@ -112,6 +121,32 @@ defmodule Pleroma.Web.ActivityPub.MRFTest do {:ok, ^expected} = MRF.describe() end + + test "it works as expected with SimplePolicy" do + clear_config([:mrf, :policies], [MRF.SimplePolicy]) + clear_config([:mrf_simple, :reject], [{"lain.com", "2kool4skool"}, "othersite.xyz"]) + + expected = %{ + exclusions: false, + mrf_hashtag: %{federated_timeline_removal: [], reject: [], sensitive: ["nsfw"]}, + mrf_policies: ["SimplePolicy", "HashtagPolicy"], + mrf_simple: %{ + accept: [], + avatar_removal: [], + banner_removal: [], + federated_timeline_removal: [], + followers_only: [], + media_nsfw: [], + media_removal: [], + reject: ["lain.com", "othersite.xyz"], + reject_deletes: [], + report_removal: [] + }, + mrf_simple_info: %{reject: %{"lain.com" => %{"reason" => "2kool4skool"}}} + } + + {:ok, ^expected} = MRF.describe() + end end test "config_descriptions/0" do |