CommonAPI Tests: Check that undoing objects federates them as embeds.

This commit is contained in:
Lain Soykaf 2020-07-24 14:54:13 +02:00
parent 3d13fb05f8
commit 1dd6de03ee

View file

@ -624,6 +624,10 @@ test "unreacting to a status with an emoji" do
user = insert(:user) user = insert(:user)
other_user = insert(:user) other_user = insert(:user)
clear_config([:instance, :federating], true)
with_mock Pleroma.Web.Federator,
publish: fn _ -> nil end do
{:ok, activity} = CommonAPI.post(other_user, %{status: "cofe"}) {:ok, activity} = CommonAPI.post(other_user, %{status: "cofe"})
{:ok, reaction} = CommonAPI.react_with_emoji(activity.id, user, "👍") {:ok, reaction} = CommonAPI.react_with_emoji(activity.id, user, "👍")
@ -632,6 +636,15 @@ test "unreacting to a status with an emoji" do
assert unreaction.data["type"] == "Undo" assert unreaction.data["type"] == "Undo"
assert unreaction.data["object"] == reaction.data["id"] assert unreaction.data["object"] == reaction.data["id"]
assert unreaction.local assert unreaction.local
# On federation, it contains the undone (and deleted) object
unreaction_with_object = %{
unreaction
| data: Map.put(unreaction.data, "object", reaction.data)
}
assert called(Pleroma.Web.Federator.publish(unreaction_with_object))
end
end end
test "repeating a status" do test "repeating a status" do