summaryrefslogtreecommitdiff
path: root/test/web/common_api/common_api_test.exs
diff options
context:
space:
mode:
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>2020-07-31 13:57:21 +0200
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>2020-07-31 13:57:21 +0200
commitac2598307d15bd833310f6c5cfadc218b7d80480 (patch)
treeedbc9f8750414dad4f43a2c88c348438c6900616 /test/web/common_api/common_api_test.exs
parente4beff90f5670876184b2593c1b4a49f2339d048 (diff)
parenta6d3bb5f30697cafc5dd9acf490bde7e2f33f5f8 (diff)
downloadpleroma-ac2598307d15bd833310f6c5cfadc218b7d80480.tar.gz
pleroma-ac2598307d15bd833310f6c5cfadc218b7d80480.zip
Merge remote-tracking branch 'pleroma/develop' into features/poll-validation
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-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