aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLain Soykaf <lain@soykaf.club>2020-07-24 14:54:13 +0200
committerLain Soykaf <lain@soykaf.club>2020-07-24 14:54:13 +0200
commit1dd6de03ee655f5247ac62fee488307c934d7378 (patch)
tree9efe53d05feeca3c4418a62ee31c2f6634d7cd3e
parent3d13fb05f851d127d852ee9c26afa4dab61410ad (diff)
downloadpleroma-1dd6de03ee655f5247ac62fee488307c934d7378.tar.gz
CommonAPI Tests: Check that undoing objects federates them as embeds.
-rw-r--r--test/web/common_api/common_api_test.exs25
1 files changed, 19 insertions, 6 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs
index 7e11fede3..313dda21b 100644
--- a/test/web/common_api/common_api_test.exs
+++ b/test/web/common_api/common_api_test.exs
@@ -624,14 +624,27 @@ defmodule Pleroma.Web.CommonAPITest do
user = insert(:user)
other_user = insert(:user)
- {:ok, activity} = CommonAPI.post(other_user, %{status: "cofe"})
- {:ok, reaction} = CommonAPI.react_with_emoji(activity.id, 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, reaction} = CommonAPI.react_with_emoji(activity.id, user, "👍")
+
+ {:ok, unreaction} = CommonAPI.unreact_with_emoji(activity.id, user, "👍")
- {:ok, unreaction} = CommonAPI.unreact_with_emoji(activity.id, user, "👍")
+ assert unreaction.data["type"] == "Undo"
+ assert unreaction.data["object"] == reaction.data["id"]
+ assert unreaction.local
- assert unreaction.data["type"] == "Undo"
- assert unreaction.data["object"] == reaction.data["id"]
- 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
test "repeating a status" do