X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fpleroma%2Fweb%2Fadmin_api%2Fcontrollers%2Freport_controller_test.exs;h=2d526527b2ee8967730b813e80578484b4efd5f8;hb=40bec73db6479850cb8b231dabc2123a93623307;hp=cbfc2e7b0655b22e4f86b58b334d4f3ab26d33f4;hpb=ed76323776f2506cfefbe78c369fdb7ccfe3b650;p=akkoma
diff --git a/test/pleroma/web/admin_api/controllers/report_controller_test.exs b/test/pleroma/web/admin_api/controllers/report_controller_test.exs
index cbfc2e7b0..2d526527b 100644
--- a/test/pleroma/web/admin_api/controllers/report_controller_test.exs
+++ b/test/pleroma/web/admin_api/controllers/report_controller_test.exs
@@ -1,9 +1,9 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.AdminAPI.ReportControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
import Pleroma.Factory
@@ -204,9 +204,7 @@ defmodule Pleroma.Web.AdminAPI.ReportControllerTest do
"@#{admin.nickname} updated report ##{id} (on user @#{activity.user_actor.nickname}) with 'resolved' state"
assert ModerationLog.get_log_entry_message(second_log_entry) ==
- "@#{admin.nickname} updated report ##{second_report_id} (on user @#{
- second_activity.user_actor.nickname
- }) with 'closed' state"
+ "@#{admin.nickname} updated report ##{second_report_id} (on user @#{second_activity.user_actor.nickname}) with 'closed' state"
end
end
@@ -305,7 +303,7 @@ defmodule Pleroma.Web.AdminAPI.ReportControllerTest do
|> get("/api/pleroma/admin/reports")
assert json_response(conn, :forbidden) ==
- %{"error" => "User is not an admin."}
+ %{"error" => "User is not a staff member."}
end
test "returns 403 when requested by anonymous" do
@@ -362,10 +360,17 @@ defmodule Pleroma.Web.AdminAPI.ReportControllerTest do
response = json_response_and_validate_schema(conn, 200)
notes = hd(response["reports"])["notes"]
- [note, _] = notes
+ assert 2 == Enum.count(notes)
+
+ note =
+ notes
+ |> Enum.find(fn note -> note["content"] == "this is disgusting!" end)
+
+ refute is_nil(note)
assert note["user"]["nickname"] == admin.nickname
- assert note["content"] == "this is disgusting!"
+ # We use '=~' because the order of the notes isn't guaranteed
+ assert note["content"] =~ "this is disgusting"
assert note["created_at"]
assert response["total"] == 1
end