2017-08-01 09:05:07 -06: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)
|
2017-08-16 08:29:25 -06:00
|
|
|
user = insert(:user)
|
|
|
|
object = Object.get_by_ap_id(note.data["object"]["id"])
|
|
|
|
|
|
|
|
{:ok, like, object} = Pleroma.Web.ActivityPub.ActivityPub.like(user, object)
|
2017-08-01 09:05:07 -06: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, []} = OStatus.handle_incoming(incoming)
|
|
|
|
|
|
|
|
refute Repo.get(Activity, note.id)
|
2017-08-16 08:29:25 -06:00
|
|
|
refute Repo.get(Activity, like.id)
|
2017-08-01 09:05:07 -06:00
|
|
|
refute Object.get_by_ap_id(note.data["object"]["id"])
|
|
|
|
assert Repo.get(Activity, second_note.id)
|
|
|
|
assert Object.get_by_ap_id(second_note.data["object"]["id"])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|