Inject fake application metadata and validate it is stripped by transmogrifier

This commit is contained in:
Mark Felder 2021-02-12 13:05:12 -06:00
parent 9b61df1fb6
commit 3554a65f45
2 changed files with 8 additions and 2 deletions

View file

@ -18,7 +18,8 @@ defmodule Pleroma.Constants do
"emoji", "emoji",
"context_id", "context_id",
"deleted_activity_id", "deleted_activity_id",
"pleroma_internal" "pleroma_internal",
"application"
] ]
) )

View file

@ -202,7 +202,11 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
test "it strips internal fields" do test "it strips internal fields" do
user = insert(:user) user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{status: "#2hu :firefox:"}) {:ok, activity} =
CommonAPI.post(user, %{
status: "#2hu :firefox:",
application: %{name: "TestClient", website: "https://pleroma.social"}
})
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
@ -213,6 +217,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
assert is_nil(modified["object"]["announcements"]) assert is_nil(modified["object"]["announcements"])
assert is_nil(modified["object"]["announcement_count"]) assert is_nil(modified["object"]["announcement_count"])
assert is_nil(modified["object"]["context_id"]) assert is_nil(modified["object"]["context_id"])
assert is_nil(modified["object"]["application"])
end end
test "it strips internal fields of article" do test "it strips internal fields of article" do