diff options
author | Egor <egor@kislitsyn.com> | 2019-02-20 16:51:25 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2019-02-20 16:51:25 +0000 |
commit | bff9eb5ef7ad446376f68807d4e51db5f2de9515 (patch) | |
tree | d1c2525ccfbee6e8e468e77611e46c7797e12d71 /test/web/common_api/common_api_test.exs | |
parent | 77fb926afa53a6d156729b1dd1613e1fed0c7910 (diff) | |
download | pleroma-bff9eb5ef7ad446376f68807d4e51db5f2de9515.tar.gz pleroma-bff9eb5ef7ad446376f68807d4e51db5f2de9515.zip |
Reports
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r-- | test/web/common_api/common_api_test.exs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index 870648fb5..9ba320f59 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -190,4 +190,35 @@ defmodule Pleroma.Web.CommonAPITest do {:error, _} = CommonAPI.add_mute(user, activity) end end + + describe "reports" do + test "creates a report" do + reporter = insert(:user) + target_user = insert(:user) + + {:ok, activity} = CommonAPI.post(target_user, %{"status" => "foobar"}) + + reporter_ap_id = reporter.ap_id + target_ap_id = target_user.ap_id + activity_ap_id = activity.data["id"] + comment = "foobar" + + report_data = %{ + "account_id" => target_user.id, + "comment" => comment, + "status_ids" => [activity.id] + } + + assert {:ok, flag_activity} = CommonAPI.report(reporter, report_data) + + assert %Activity{ + actor: ^reporter_ap_id, + data: %{ + "type" => "Flag", + "content" => ^comment, + "object" => [^target_ap_id, ^activity_ap_id] + } + } = flag_activity + end + end end |