1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ActivityPub.MRF.NoPlaceholderTextPolicyTest do
6 use Pleroma.DataCase, async: true
7 alias Pleroma.Web.ActivityPub.MRF.NoPlaceholderTextPolicy
9 test "it clears content object" do
12 "object" => %{"content" => ".", "attachment" => "image"}
15 assert {:ok, res} = NoPlaceholderTextPolicy.filter(message)
16 assert res["object"]["content"] == ""
18 message = put_in(message, ["object", "content"], "<p>.</p>")
19 assert {:ok, res} = NoPlaceholderTextPolicy.filter(message)
20 assert res["object"]["content"] == ""
26 "object" => %{"content" => "test", "attachment" => "image"}
28 %{"type" => "Create", "object" => %{"content" => "."}},
29 %{"type" => "Create", "object" => %{"content" => "<p>.</p>"}}
31 test "it skips filter" do
32 Enum.each(@messages, fn message ->
33 assert {:ok, res} = NoPlaceholderTextPolicy.filter(message)