diff options
author | lain <lain@soykaf.club> | 2020-05-11 15:06:23 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-05-11 15:06:23 +0200 |
commit | 5367a00257c6f862a4a8080e0176f676ce491e4d (patch) | |
tree | b6190e2bd0b02483d43438cb337f5df111ee1392 /test/web/common_api/common_api_test.exs | |
parent | 84bb116ae3854c17b85a780fe6dae03c0bd8eaa7 (diff) | |
download | pleroma-5367a00257c6f862a4a8080e0176f676ce491e4d.tar.gz pleroma-5367a00257c6f862a4a8080e0176f676ce491e4d.zip |
Deletion: Handle the case of pruned objects.
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r-- | test/web/common_api/common_api_test.exs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index 2fd17a1b8..c524d1c0c 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -24,6 +24,24 @@ defmodule Pleroma.Web.CommonAPITest do setup do: clear_config([:instance, :max_pinned_statuses]) describe "deletion" do + test "it works with pruned objects" do + user = insert(:user) + + {:ok, post} = CommonAPI.post(user, %{"status" => "namu amida butsu"}) + + Object.normalize(post, false) + |> Object.prune() + + with_mock Pleroma.Web.Federator, + publish: fn _ -> nil end do + assert {:ok, delete} = CommonAPI.delete(post.id, user) + assert delete.local + assert called(Pleroma.Web.Federator.publish(delete)) + end + + refute Activity.get_by_id(post.id) + end + test "it allows users to delete their posts" do user = insert(:user) |