summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLain Soykaf <lain@lain.com>2023-11-27 17:55:16 +0400
committerLain Soykaf <lain@lain.com>2023-11-27 17:55:16 +0400
commit5a3b81d92ef532769a11d4374424665f6d97a08f (patch)
tree609dd1420e8b315a6c20a298efb41cbdb09bc09c
parent4ebfc011fc5cb24dab9aa187372579ebbadb6cd2 (diff)
downloadpleroma-5a3b81d92ef532769a11d4374424665f6d97a08f.tar.gz
pleroma-5a3b81d92ef532769a11d4374424665f6d97a08f.zip
ActivityPub.UtilsTest: Add failing test for strip_report_status_data
-rw-r--r--test/pleroma/web/activity_pub/utils_test.exs31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/pleroma/web/activity_pub/utils_test.exs b/test/pleroma/web/activity_pub/utils_test.exs
index 3f93c872b..05bff1e1c 100644
--- a/test/pleroma/web/activity_pub/utils_test.exs
+++ b/test/pleroma/web/activity_pub/utils_test.exs
@@ -16,6 +16,37 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do
require Pleroma.Constants
+ describe "strip_report_status_data/1" do
+ test "does not break on issues with the reported activites" do
+ reporter = insert(:user)
+ target_account = insert(:user)
+ {:ok, activity} = CommonAPI.post(target_account, %{status: "foobar"})
+ context = Utils.generate_context_id()
+ content = "foobar"
+
+ res =
+ Utils.make_flag_data(
+ %{
+ actor: reporter,
+ context: context,
+ account: target_account,
+ statuses: [%{"id" => activity.data["id"]}],
+ content: content
+ },
+ %{}
+ )
+
+ res =
+ res
+ |> Map.put("object", res["object"] ++ [nil, 1, 5, "123"])
+
+ {:ok, activity} = Pleroma.Web.ActivityPub.ActivityPub.insert(res)
+
+ Utils.strip_report_status_data(activity)
+ |> IO.inspect()
+ end
+ end
+
describe "fetch the latest Follow" do
test "fetches the latest Follow activity" do
%Activity{data: %{"type" => "Follow"}} = activity = insert(:follow_activity)