diff options
author | Sergey Suprunenko <suprunenko.s@gmail.com> | 2019-07-10 05:16:08 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2019-07-10 05:16:08 +0000 |
commit | 2d2b50cccaa99b551b88be36a4b33b271300d3c8 (patch) | |
tree | 11f542ebcf189ddff5656b97d3cddd8a0bcc5159 /test/web | |
parent | 75be90a6d177b00c4ca1083331975805c6f9afde (diff) | |
download | pleroma-2d2b50cccaa99b551b88be36a4b33b271300d3c8.tar.gz pleroma-2d2b50cccaa99b551b88be36a4b33b271300d3c8.zip |
Send and handle "Delete" activity for deleted users
Diffstat (limited to 'test/web')
-rw-r--r-- | test/web/activity_pub/transmogrifier_test.exs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index d152169b8..825e99879 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -553,6 +553,30 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do assert Activity.get_by_id(activity.id) end + test "it works for incoming user deletes" do + %{ap_id: ap_id} = insert(:user, ap_id: "http://mastodon.example.org/users/admin") + + data = + File.read!("test/fixtures/mastodon-delete-user.json") + |> Poison.decode!() + + {:ok, _} = Transmogrifier.handle_incoming(data) + + refute User.get_cached_by_ap_id(ap_id) + end + + test "it fails for incoming user deletes with spoofed origin" do + %{ap_id: ap_id} = insert(:user) + + data = + File.read!("test/fixtures/mastodon-delete-user.json") + |> Poison.decode!() + |> Map.put("actor", ap_id) + + assert :error == Transmogrifier.handle_incoming(data) + assert User.get_cached_by_ap_id(ap_id) + end + test "it works for incoming unannounces with an existing notice" do user = insert(:user) {:ok, activity} = CommonAPI.post(user, %{"status" => "hey"}) |