summaryrefslogtreecommitdiff
path: root/test/web/admin_api/admin_api_controller_test.exs
diff options
context:
space:
mode:
authorMaxim Filippov <colixer@gmail.com>2019-12-08 11:27:23 +0300
committerMaxim Filippov <colixer@gmail.com>2019-12-08 11:27:23 +0300
commita7f77785c2675b5f9f7ede85e92ec50444945e54 (patch)
tree9397e4d00fa8193717fef41b921d820eb5bb9de9 /test/web/admin_api/admin_api_controller_test.exs
parent08c89fd2b89614baaf4bfce067cfec9db96f2d2c (diff)
downloadpleroma-a7f77785c2675b5f9f7ede85e92ec50444945e54.tar.gz
pleroma-a7f77785c2675b5f9f7ede85e92ec50444945e54.zip
Implement report notes destruction
Diffstat (limited to 'test/web/admin_api/admin_api_controller_test.exs')
-rw-r--r--test/web/admin_api/admin_api_controller_test.exs15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/web/admin_api/admin_api_controller_test.exs b/test/web/admin_api/admin_api_controller_test.exs
index 2a3e49af8..fda47300c 100644
--- a/test/web/admin_api/admin_api_controller_test.exs
+++ b/test/web/admin_api/admin_api_controller_test.exs
@@ -10,6 +10,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
alias Pleroma.HTML
alias Pleroma.ModerationLog
alias Pleroma.Repo
+ alias Pleroma.ReportNote
alias Pleroma.Tests.ObanHelpers
alias Pleroma.User
alias Pleroma.UserInviteToken
@@ -2940,7 +2941,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
end
test "it creates report note", %{admin_id: admin_id, report_id: report_id} do
- [note, _] = Repo.all(Pleroma.ReportNote)
+ [note, _] = Repo.all(ReportNote)
assert %{
activity_id: ^report_id,
@@ -2964,6 +2965,18 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
assert note["created_at"]
assert response["total"] == 1
end
+
+ test "it deletes the note", %{admin: admin, report_id: report_id} do
+ assert ReportNote |> Repo.all() |> length() == 2
+
+ [note, _] = Repo.all(ReportNote)
+
+ build_conn()
+ |> assign(:user, admin)
+ |> delete("/api/pleroma/admin/reports/#{report_id}/notes/#{note.id}")
+
+ assert ReportNote |> Repo.all() |> length() == 1
+ end
end
end