Pleroma/test/web/ostatus/incoming_documents/delete_handling_test.exs

36 lines
1.2 KiB
Elixir
Raw Normal View History

2017-08-01 17:05:07 +02:00
defmodule Pleroma.Web.OStatus.DeleteHandlingTest do
use Pleroma.DataCase
import Pleroma.Factory
alias Pleroma.{Repo, Activity, Object}
alias Pleroma.Web.OStatus
describe "deletions" do
test "it removes the mentioned activity" do
note = insert(:note_activity)
second_note = insert(:note_activity)
user = insert(:user)
object = Object.get_by_ap_id(note.data["object"]["id"])
2018-02-12 10:13:54 +01:00
{:ok, like, _object} = Pleroma.Web.ActivityPub.ActivityPub.like(user, object)
2017-08-01 17:05:07 +02:00
2018-03-30 15:01:53 +02:00
incoming =
File.read!("test/fixtures/delete.xml")
|> String.replace(
"tag:mastodon.sdf.org,2017-06-10:objectId=310513:objectType=Status",
note.data["object"]["id"]
)
{:ok, [delete]} = OStatus.handle_incoming(incoming)
2017-08-01 17:05:07 +02:00
2018-12-24 22:29:13 +01:00
assert Repo.get(Activity, note.id).data["type"] == "Tombstone"
assert Repo.get(Activity, like.id).data["type"] == "Tombstone"
assert Object.get_by_ap_id(note.data["object"]["id"]).data["type"] == "Tombstone"
2017-08-01 17:05:07 +02:00
assert Repo.get(Activity, second_note.id)
assert Object.get_by_ap_id(second_note.data["object"]["id"])
assert delete.data["type"] == "Delete"
2017-08-01 17:05:07 +02:00
end
end
end