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",
"context_id",
"deleted_activity_id",
"pleroma_internal"
"pleroma_internal",
"application"
]
)

View File

@ -202,7 +202,11 @@ test "it strips internal hashtag data" do
test "it strips internal fields" do
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)
@ -213,6 +217,7 @@ test "it strips internal fields" do
assert is_nil(modified["object"]["announcements"])
assert is_nil(modified["object"]["announcement_count"])
assert is_nil(modified["object"]["context_id"])
assert is_nil(modified["object"]["application"])
end
test "it strips internal fields of article" do