Transmogrifier: Do not crash if inReplyTo does not exist and can't be fetched
[akkoma] / test / object / containment_test.exs
index fcedb2283cbeb6fd36a428c840d01cd85d0266bb..a7a046203a5d24ef5b8aed51f0b2fed89654dde0 100644 (file)
@@ -1,12 +1,16 @@
 defmodule Pleroma.Object.ContainmentTest do
   use Pleroma.DataCase
 
-  alias Pleroma.User
   alias Pleroma.Object.Containment
-  alias Pleroma.Web.ActivityPub.ActivityPub
+  alias Pleroma.User
 
   import Pleroma.Factory
 
+  setup_all do
+    Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
+    :ok
+  end
+
   describe "general origin containment" do
     test "contain_origin_from_id() catches obvious spoofing attempts" do
       data = %{
@@ -45,7 +49,7 @@ defmodule Pleroma.Object.ContainmentTest do
     end
 
     test "users cannot be collided through fake direction spoofing attempts" do
-      user =
+      _user =
         insert(:user, %{
           nickname: "rye@niu.moe",
           local: false,
@@ -55,12 +59,5 @@ defmodule Pleroma.Object.ContainmentTest do
 
       {:error, _} = User.get_or_fetch_by_ap_id("https://n1u.moe/users/rye")
     end
-
-    test "all objects with fake directions are rejected by the object fetcher" do
-      {:error, _} =
-        ActivityPub.fetch_and_contain_remote_object_from_id(
-          "https://info.pleroma.site/activity4.json"
-        )
-    end
   end
 end