ActivityPub.UtilsTest: Add failing test for strip_report_status_data

This commit is contained in:
Lain Soykaf 2023-11-27 17:55:16 +04:00
parent 4ebfc011fc
commit 5a3b81d92e

View File

@ -16,6 +16,37 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do
require Pleroma.Constants 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 describe "fetch the latest Follow" do
test "fetches the latest Follow activity" do test "fetches the latest Follow activity" do
%Activity{data: %{"type" => "Follow"}} = activity = insert(:follow_activity) %Activity{data: %{"type" => "Follow"}} = activity = insert(:follow_activity)