X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fobject%2Fcontainment_test.exs;h=a860355b8e21eff9a64d8f8a8f1692f56f8daf33;hb=4d8f97453b98c996e71d10e85f86b2a30e71f2b4;hp=fcedb2283cbeb6fd36a428c840d01cd85d0266bb;hpb=e8caecb5c7f49a829b857131ff98a46c705e3a80;p=akkoma diff --git a/test/object/containment_test.exs b/test/object/containment_test.exs index fcedb2283..a860355b8 100644 --- a/test/object/containment_test.exs +++ b/test/object/containment_test.exs @@ -1,11 +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 + import ExUnit.CaptureLog + + 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 @@ -45,7 +50,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, @@ -53,14 +58,10 @@ defmodule Pleroma.Object.ContainmentTest do follower_address: User.ap_followers(%User{nickname: "rye@niu.moe"}) }) - {: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" - ) + assert capture_log(fn -> + {:error, _} = User.get_or_fetch_by_ap_id("https://n1u.moe/users/rye") + end) =~ + "[error] Could not decode user at fetch https://n1u.moe/users/rye, {:error, :error}" end end end