Merge branch 'bugfix/change_password' into 'develop'
[akkoma] / test / pleroma / web / activity_pub / mrf / object_age_policy_test.exs
index cf6acc9a2d17ee2e16550f3dc20d184792e6eff1..2f649a0a4818e731fe7cc04944709331d14c261d 100644 (file)
@@ -1,10 +1,9 @@
 # Pleroma: A lightweight social networking server
 # 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
 # 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
   alias Pleroma.User
   alias Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy
   alias Pleroma.Web.ActivityPub.Visibility
@@ -22,7 +21,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
 
   defp get_old_message do
     File.read!("test/fixtures/mastodon-post-activity.json")
 
   defp get_old_message do
     File.read!("test/fixtures/mastodon-post-activity.json")
-    |> Poison.decode!()
+    |> Jason.decode!()
+    |> Map.drop(["published"])
   end
 
   defp get_new_message do
   end
 
   defp get_new_message do
@@ -39,7 +39,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
 
   describe "with reject action" do
     test "works with objects with empty to or cc fields" 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()
 
       data =
         get_old_message()
@@ -50,7 +50,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
     end
 
     test "it rejects an old post" do
     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()
 
 
       data = get_old_message()
 
@@ -58,7 +58,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
     end
 
     test "it allows a new post" do
     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()
 
 
       data = get_new_message()
 
@@ -68,7 +68,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
 
   describe "with delist action" do
     test "works with objects with empty to or cc fields" do
 
   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()
 
       data =
         get_old_message()
@@ -83,7 +83,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
     end
 
     test "it delists an old post" do
     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()
 
 
       data = get_old_message()
 
@@ -95,7 +95,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
     end
 
     test "it allows a new post" do
     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()
 
 
       data = get_new_message()
 
@@ -107,7 +107,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
 
   describe "with strip_followers action" do
     test "works with objects with empty to or cc fields" do
 
   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()
 
       data =
         get_old_message()
@@ -123,7 +123,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
     end
 
     test "it strips followers collections from an old post" do
     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()
 
 
       data = get_old_message()
 
@@ -136,7 +136,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
     end
 
     test "it allows a new post" do
     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()
 
 
       data = get_new_message()