From 2e2edcb461d514609848749355db6fab92e2b4f3 Mon Sep 17 00:00:00 2001 From: Alex S Date: Sun, 16 Jun 2019 19:42:29 +0800 Subject: [PATCH] capturing errors --- test/web/activity_pub/transmogrifier_test.exs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index cc1781403..68ec03c33 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -15,6 +15,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do alias Pleroma.Web.Websub.WebsubClientSubscription import Pleroma.Factory + import ExUnit.CaptureLog alias Pleroma.Web.CommonAPI setup_all do @@ -73,7 +74,9 @@ test "it does not crash if the object in inReplyTo can't be fetched" do data |> Map.put("object", object) - {:ok, _returned_activity} = Transmogrifier.handle_incoming(data) + assert capture_log(fn -> + {:ok, _returned_activity} = Transmogrifier.handle_incoming(data) + end) =~ "[error] Couldn't fetch \"\"https://404.site/whatever\"\", error: nil" end test "it works for incoming notices" do @@ -516,7 +519,10 @@ test "it fails for incoming deletes with spoofed origin" do data |> Map.put("object", object) - :error = Transmogrifier.handle_incoming(data) + assert capture_log(fn -> + :error = Transmogrifier.handle_incoming(data) + end) =~ + "[error] Could not decode user at fetch http://mastodon.example.org/users/gargron, {:error, {:error, :nxdomain}}" assert Activity.get_by_id(activity.id) end