# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
use Pleroma.DataCase
- alias Pleroma.Config
alias Pleroma.User
alias Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy
alias Pleroma.Web.ActivityPub.Visibility
defp get_old_message do
File.read!("test/fixtures/mastodon-post-activity.json")
|> Jason.decode!()
+ |> Map.drop(["published"])
end
defp get_new_message do
describe "with reject action" do
test "works with objects with empty to or cc fields" do
- Config.put([:mrf_object_age, :actions], [:reject])
+ clear_config([:mrf_object_age, :actions], [:reject])
data =
get_old_message()
end
test "it rejects an old post" do
- Config.put([:mrf_object_age, :actions], [:reject])
+ clear_config([:mrf_object_age, :actions], [:reject])
data = get_old_message()
end
test "it allows a new post" do
- Config.put([:mrf_object_age, :actions], [:reject])
+ clear_config([:mrf_object_age, :actions], [:reject])
data = get_new_message()
describe "with delist action" do
test "works with objects with empty to or cc fields" do
- Config.put([:mrf_object_age, :actions], [:delist])
+ clear_config([:mrf_object_age, :actions], [:delist])
data =
get_old_message()
end
test "it delists an old post" do
- Config.put([:mrf_object_age, :actions], [:delist])
+ clear_config([:mrf_object_age, :actions], [:delist])
data = get_old_message()
end
test "it allows a new post" do
- Config.put([:mrf_object_age, :actions], [:delist])
+ clear_config([:mrf_object_age, :actions], [:delist])
data = get_new_message()
describe "with strip_followers action" do
test "works with objects with empty to or cc fields" do
- Config.put([:mrf_object_age, :actions], [:strip_followers])
+ clear_config([:mrf_object_age, :actions], [:strip_followers])
data =
get_old_message()
end
test "it strips followers collections from an old post" do
- Config.put([:mrf_object_age, :actions], [:strip_followers])
+ clear_config([:mrf_object_age, :actions], [:strip_followers])
data = get_old_message()
end
test "it allows a new post" do
- Config.put([:mrf_object_age, :actions], [:strip_followers])
+ clear_config([:mrf_object_age, :actions], [:strip_followers])
data = get_new_message()