X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fostatus%2Fincoming_documents%2Fdelete_handling_test.exs;h=ca6e6133952b36d1ba0c3f366d05487733087bf2;hb=1557b99beb3b406572ef2d3baaabed1c9baeca1c;hp=43d04dea269d468fff66524c2dfb6400342da891;hpb=26ccb768d39515faa3b1db7f1371ecf2517eb6bf;p=akkoma diff --git a/test/web/ostatus/incoming_documents/delete_handling_test.exs b/test/web/ostatus/incoming_documents/delete_handling_test.exs index 43d04dea2..ca6e61339 100644 --- a/test/web/ostatus/incoming_documents/delete_handling_test.exs +++ b/test/web/ostatus/incoming_documents/delete_handling_test.exs @@ -2,9 +2,17 @@ defmodule Pleroma.Web.OStatus.DeleteHandlingTest do use Pleroma.DataCase import Pleroma.Factory - alias Pleroma.{Repo, Activity, Object} + import Tesla.Mock + + alias Pleroma.Activity + alias Pleroma.Object alias Pleroma.Web.OStatus + setup do + mock(fn env -> apply(HttpRequestMock, :request, [env]) end) + :ok + end + describe "deletions" do test "it removes the mentioned activity" do note = insert(:note_activity) @@ -14,14 +22,19 @@ defmodule Pleroma.Web.OStatus.DeleteHandlingTest do {:ok, like, _object} = Pleroma.Web.ActivityPub.ActivityPub.like(user, object) - incoming = File.read!("test/fixtures/delete.xml") - |> String.replace("tag:mastodon.sdf.org,2017-06-10:objectId=310513:objectType=Status", note.data["object"]["id"]) + 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) - refute Repo.get(Activity, note.id) - refute Repo.get(Activity, like.id) - refute Object.get_by_ap_id(note.data["object"]["id"]) - assert Repo.get(Activity, second_note.id) + refute Activity.get_by_id(note.id) + refute Activity.get_by_id(like.id) + assert Object.get_by_ap_id(note.data["object"]["id"]).data["type"] == "Tombstone" + assert Activity.get_by_id(second_note.id) assert Object.get_by_ap_id(second_note.data["object"]["id"]) assert delete.data["type"] == "Delete"