diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2020-07-27 21:20:52 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2020-07-27 21:20:52 +0000 |
commit | 057936bf0b5af2cc35a6ecb1c800a841ca4760a8 (patch) | |
tree | 5f7aebf08a4cb5c2b2f020b5122c885f1a50ec6a /test/web/common_api/common_api_test.exs | |
parent | 2a3abfd326f0cbb588dfe66a23e9783be3038a5e (diff) | |
parent | 9e6f4694dd21f92bb2292e819d0f7f1cad149887 (diff) | |
download | pleroma-057936bf0b5af2cc35a6ecb1c800a841ca4760a8.tar.gz pleroma-057936bf0b5af2cc35a6ecb1c800a841ca4760a8.zip |
Merge branch 'embedded-object-federation' into 'develop'
Embedded object federation
Closes #1959
See merge request pleroma/pleroma!2794
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r-- | test/web/common_api/common_api_test.exs | 25 |
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 |