Reports
This commit is contained in:
parent
77fb926afa
commit
bff9eb5ef7
18 changed files with 347 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue