capturing errors

This commit is contained in:
Alex S 2019-06-16 19:42:29 +08:00
parent 0f59265a50
commit 2e2edcb461

View File

@ -15,6 +15,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
alias Pleroma.Web.Websub.WebsubClientSubscription alias Pleroma.Web.Websub.WebsubClientSubscription
import Pleroma.Factory import Pleroma.Factory
import ExUnit.CaptureLog
alias Pleroma.Web.CommonAPI alias Pleroma.Web.CommonAPI
setup_all do setup_all do
@ -73,7 +74,9 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
data data
|> Map.put("object", object) |> Map.put("object", object)
assert capture_log(fn ->
{:ok, _returned_activity} = Transmogrifier.handle_incoming(data) {:ok, _returned_activity} = Transmogrifier.handle_incoming(data)
end) =~ "[error] Couldn't fetch \"\"https://404.site/whatever\"\", error: nil"
end end
test "it works for incoming notices" do test "it works for incoming notices" do
@ -516,7 +519,10 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
data data
|> Map.put("object", object) |> Map.put("object", object)
assert capture_log(fn ->
:error = Transmogrifier.handle_incoming(data) :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) assert Activity.get_by_id(activity.id)
end end