Tests: Capture log.

This commit is contained in:
lain 2019-10-18 12:44:53 +02:00
parent 4ec299ea9c
commit 15bbc34c07
2 changed files with 8 additions and 3 deletions

View File

@ -14,6 +14,8 @@ defmodule Pleroma.NotificationTest do
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.Streamer
import ExUnit.CaptureLog
describe "create_notifications" do
test "notifies someone when they are directly addressed" do
user = insert(:user)
@ -533,7 +535,9 @@ test "liking an activity which is already deleted does not generate a notificati
assert Enum.empty?(Notification.for_user(user))
{:error, _} = CommonAPI.favorite(other_user, activity.id)
assert capture_log(fn ->
{:error, _} = CommonAPI.favorite(other_user, activity.id)
end) =~ "[error]"
assert Enum.empty?(Notification.for_user(user))
end

View File

@ -275,9 +275,10 @@ test "favoriting a status twice returns an error" do
{:ok, activity} = CommonAPI.post(other_user, %{"status" => "cofe"})
{:ok, %Activity{}} = CommonAPI.favorite(user, activity.id)
assert capture_log(fn ->
assert {:error, _} = CommonAPI.favorite(user, activity.id)
end) =~ "[error]"
assert {:error, _} = CommonAPI.favorite(user, activity.id)
end) =~ "[error]"
end
end