1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ActivityPub.MRF.SubchainPolicyTest do
8 alias Pleroma.Web.ActivityPub.MRF.DropPolicy
9 alias Pleroma.Web.ActivityPub.MRF.SubchainPolicy
12 "actor" => "https://banned.com",
14 "object" => %{"content" => "hi"}
16 setup do: clear_config([:mrf_subchain, :match_actor])
18 test "it matches and processes subchains when the actor matches a configured target" do
19 clear_config([:mrf_subchain, :match_actor], %{
20 ~r/^https:\/\/banned.com/s => [DropPolicy]
23 {:reject, _} = SubchainPolicy.filter(@message)
26 test "it doesn't match and process subchains when the actor doesn't match a configured target" do
27 clear_config([:mrf_subchain, :match_actor], %{
28 ~r/^https:\/\/borked.com/s => [DropPolicy]
31 {:ok, _message} = SubchainPolicy.filter(@message)