Add basic incoming deletions.
[akkoma] / test / web / ostatus / incoming_documents / delete_handling_test.exs
1 defmodule Pleroma.Web.OStatus.DeleteHandlingTest do
2 use Pleroma.DataCase
3
4 import Pleroma.Factory
5 alias Pleroma.{Repo, Activity, Object}
6 alias Pleroma.Web.OStatus
7
8 describe "deletions" do
9 test "it removes the mentioned activity" do
10 note = insert(:note_activity)
11 second_note = insert(:note_activity)
12
13 incoming = File.read!("test/fixtures/delete.xml")
14 |> String.replace("tag:mastodon.sdf.org,2017-06-10:objectId=310513:objectType=Status", note.data["object"]["id"])
15 {:ok, []} = OStatus.handle_incoming(incoming)
16
17 refute Repo.get(Activity, note.id)
18 refute Object.get_by_ap_id(note.data["object"]["id"])
19 assert Repo.get(Activity, second_note.id)
20 assert Object.get_by_ap_id(second_note.data["object"]["id"])
21 end
22 end
23 end