aboutsummaryrefslogtreecommitdiff
path: root/test/web/common_api
diff options
context:
space:
mode:
authorSergey Suprunenko <suprunenko.s@gmail.com>2019-05-16 19:09:18 +0000
committerfeld <feld@feld.me>2019-05-16 19:09:18 +0000
commite2b3a27204ca511a2e455a1151fdea36fdc0e53d (patch)
tree2f6f13d59fb1e42a8e932cb28d54416b297ad588 /test/web/common_api
parente190b3022b29753fd7682947a293775c8801d4b7 (diff)
downloadpleroma-e2b3a27204ca511a2e455a1151fdea36fdc0e53d.tar.gz
Add Reports to Admin API
Diffstat (limited to 'test/web/common_api')
-rw-r--r--test/web/common_api/common_api_test.exs33
1 files changed, 32 insertions, 1 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs
index 8d4f401ee..38b5aa65f 100644
--- a/test/web/common_api/common_api_test.exs
+++ b/test/web/common_api/common_api_test.exs
@@ -261,10 +261,41 @@ defmodule Pleroma.Web.CommonAPITest do
data: %{
"type" => "Flag",
"content" => ^comment,
- "object" => [^target_ap_id, ^activity_ap_id]
+ "object" => [^target_ap_id, ^activity_ap_id],
+ "state" => "open"
}
} = flag_activity
end
+
+ test "updates report state" do
+ [reporter, target_user] = insert_pair(:user)
+ activity = insert(:note_activity, user: target_user)
+
+ {:ok, %Activity{id: report_id}} =
+ CommonAPI.report(reporter, %{
+ "account_id" => target_user.id,
+ "comment" => "I feel offended",
+ "status_ids" => [activity.id]
+ })
+
+ {:ok, report} = CommonAPI.update_report_state(report_id, "resolved")
+
+ assert report.data["state"] == "resolved"
+ end
+
+ test "does not update report state when state is unsupported" do
+ [reporter, target_user] = insert_pair(:user)
+ activity = insert(:note_activity, user: target_user)
+
+ {:ok, %Activity{id: report_id}} =
+ CommonAPI.report(reporter, %{
+ "account_id" => target_user.id,
+ "comment" => "I feel offended",
+ "status_ids" => [activity.id]
+ })
+
+ assert CommonAPI.update_report_state(report_id, "test") == {:error, "Unsupported state"}
+ end
end
describe "reblog muting" do