瀏覽代碼

Tests: Capture log.

debug-remote-ip
lain 4 年之前
父節點
當前提交
15bbc34c07
共有 2 個文件被更改,包括 8 次插入3 次删除
  1. +5
    -1
      test/notification_test.exs
  2. +3
    -2
      test/web/common_api/common_api_test.exs

+ 5
- 1
test/notification_test.exs 查看文件

@@ -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 @@ defmodule Pleroma.NotificationTest do

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


+ 3
- 2
test/web/common_api/common_api_test.exs 查看文件

@@ -275,9 +275,10 @@ defmodule Pleroma.Web.CommonAPITest 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



Loading…
取消
儲存