StatusControllerTest: Capture log.
authorlain <lain@soykaf.club>
Sat, 19 Oct 2019 12:46:14 +0000 (14:46 +0200)
committerlain <lain@soykaf.club>
Sat, 19 Oct 2019 12:46:14 +0000 (14:46 +0200)
test/web/mastodon_api/controllers/status_controller_test.exs

index 1414d9fed5074b2646ad3d0cb8298c82760b0541..2bbd8a15163693a98dbe5179e98fe728e07cafb7 100644 (file)
@@ -17,6 +17,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
   alias Pleroma.Web.CommonAPI
 
   import Pleroma.Factory
+  import ExUnit.CaptureLog
 
   describe "posting statuses" do
     setup do
@@ -681,12 +682,14 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
     test "returns 400 error for a wrong id", %{conn: conn} do
       user = insert(:user)
 
-      conn =
-        conn
-        |> assign(:user, user)
-        |> post("/api/v1/statuses/1/favourite")
+      assert capture_log(fn ->
+               conn =
+                 conn
+                 |> assign(:user, user)
+                 |> post("/api/v1/statuses/1/favourite")
 
-      assert json_response(conn, 400) == %{"error" => "Could not favorite"}
+               assert json_response(conn, 400) == %{"error" => "Could not favorite"}
+             end) =~ "[error]"
     end
   end