Add failing test, which exposes a bug
authorMaxim Filippov <colixer@gmail.com>
Thu, 5 Dec 2019 03:07:53 +0000 (12:07 +0900)
committerMaxim Filippov <colixer@gmail.com>
Thu, 5 Dec 2019 03:07:53 +0000 (12:07 +0900)
test/web/admin_api/admin_api_controller_test.exs

index 44557ea451e8b5007d299e4b3774a314eff31640..453c290e4cf0b4a61f9f0b61f1e1a8562ecc8e56 100644 (file)
@@ -2926,6 +2926,12 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
         content: "this is disgusting!"
       })
 
+      build_conn()
+      |> assign(:user, admin)
+      |> post("/api/pleroma/admin/reports/#{report_id}/notes", %{
+        content: "this is disgusting2!"
+      })
+
       %{
         admin_id: admin.id,
         report_id: report_id,
@@ -2947,12 +2953,13 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
         |> assign(:user, admin)
         |> get("/api/pleroma/admin/reports")
 
-      reponse = json_response(conn, 200)
-      notes = hd(reponse["reports"])["notes"]
-      [note] = notes
+      response = json_response(conn, 200)
+      notes = hd(response["reports"])["notes"]
+      [note, _] = notes
 
       assert note["user"]["nickname"] == admin.nickname
       assert note["content"] == "this is disgusting!"
+      assert response["total"] == 1
     end
   end
 end