Merge remote-tracking branch 'pleroma/develop' into feature/disable-account
[akkoma] / test / web / ostatus / incoming_documents / delete_handling_test.exs
index 1e041e5b091b026260159e0a65193f21d1d54274..ca6e6133952b36d1ba0c3f366d05487733087bf2 100644 (file)
@@ -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)
@@ -23,10 +31,10 @@ defmodule Pleroma.Web.OStatus.DeleteHandlingTest do
 
       {: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"