diff options
author | feld <feld@feld.me> | 2019-11-14 13:35:41 +0000 |
---|---|---|
committer | feld <feld@feld.me> | 2019-11-14 13:35:41 +0000 |
commit | 1afeaf82fa3f1718233f5012f851912f87f35a88 (patch) | |
tree | 8d0e6b91d34edc574cf18c9188eaadf2e69443b4 /test/web/common_api | |
parent | 574369b42dd7b62e41c3a4429e4e66b9a9b3483d (diff) | |
parent | 46787b9fe1c61d5139198187a0d2013f1a2e5162 (diff) | |
download | pleroma-1afeaf82fa3f1718233f5012f851912f87f35a88.tar.gz |
Merge branch 'feature/reports-groups-and-multiple-state-update' into 'develop'
Admin API: Grouped reports, update multiple reports in one query
Closes admin-fe#43
See merge request pleroma/pleroma!1815
Diffstat (limited to 'test/web/common_api')
-rw-r--r-- | test/web/common_api/common_api_test.exs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index 09a3e8dcf..138488d44 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -468,6 +468,35 @@ defmodule Pleroma.Web.CommonAPITest do assert CommonAPI.update_report_state(report_id, "test") == {:error, "Unsupported state"} end + + test "updates state of multiple reports" do + [reporter, target_user] = insert_pair(:user) + activity = insert(:note_activity, user: target_user) + + {:ok, %Activity{id: first_report_id}} = + CommonAPI.report(reporter, %{ + "account_id" => target_user.id, + "comment" => "I feel offended", + "status_ids" => [activity.id] + }) + + {:ok, %Activity{id: second_report_id}} = + CommonAPI.report(reporter, %{ + "account_id" => target_user.id, + "comment" => "I feel very offended!", + "status_ids" => [activity.id] + }) + + {:ok, report_ids} = + CommonAPI.update_report_state([first_report_id, second_report_id], "resolved") + + first_report = Activity.get_by_id(first_report_id) + second_report = Activity.get_by_id(second_report_id) + + assert report_ids -- [first_report_id, second_report_id] == [] + assert first_report.data["state"] == "resolved" + assert second_report.data["state"] == "resolved" + end end describe "reblog muting" do |