X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fviews%2Ferror_view_test.exs;h=4e5398c834cb55d98fea1b8508d0d4209d4a5bd9;hb=815f659ed893d860c8ed1fbbd762e837147c214b;hp=16a0c8cefb97b67ea25bf527cd1d73bd7231dbe4;hpb=e4dc3f71aea900e566c0d66ddffc5cd57e3920dd;p=akkoma
diff --git a/test/web/views/error_view_test.exs b/test/web/views/error_view_test.exs
index 16a0c8cef..4e5398c83 100644
--- a/test/web/views/error_view_test.exs
+++ b/test/web/views/error_view_test.exs
@@ -1,9 +1,10 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2018 Pleroma Authors
+# Copyright © 2017-2019 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ErrorViewTest do
use Pleroma.Web.ConnCase, async: true
+ import ExUnit.CaptureLog
# Bring render/3 and render_to_string/3 for testing custom views
import Phoenix.View
@@ -13,12 +14,23 @@ defmodule Pleroma.Web.ErrorViewTest do
end
test "render 500.json" do
- assert render(Pleroma.Web.ErrorView, "500.json", []) ==
- %{errors: %{detail: "Internal server error"}}
+ assert capture_log(fn ->
+ assert render(Pleroma.Web.ErrorView, "500.json", []) ==
+ %{errors: %{detail: "Internal server error", reason: "nil"}}
+ end) =~ "[error] Internal server error: nil"
end
test "render any other" do
- assert render(Pleroma.Web.ErrorView, "505.json", []) ==
- %{errors: %{detail: "Internal server error"}}
+ assert capture_log(fn ->
+ assert render(Pleroma.Web.ErrorView, "505.json", []) ==
+ %{errors: %{detail: "Internal server error", reason: "nil"}}
+ end) =~ "[error] Internal server error: nil"
+ end
+
+ test "render 500.json with reason" do
+ assert capture_log(fn ->
+ assert render(Pleroma.Web.ErrorView, "500.json", reason: "test reason") ==
+ %{errors: %{detail: "Internal server error", reason: "\"test reason\""}}
+ end) =~ "[error] Internal server error: \"test reason\""
end
end