diff options
author | marcin mikołajczak <git@mkljczk.pl> | 2022-05-30 12:30:03 +0200 |
---|---|---|
committer | marcin mikołajczak <git@mkljczk.pl> | 2022-05-30 12:30:03 +0200 |
commit | b354d70e85bbf0f685f3d56f7377fde2efce4187 (patch) | |
tree | 2d5fe2a75127ebc1403f5b3055125cbc8a9932da /test | |
parent | 5c383ada8ad7491125a8264a8a03d85fe822f61e (diff) | |
download | pleroma-b354d70e85bbf0f685f3d56f7377fde2efce4187.tar.gz pleroma-b354d70e85bbf0f685f3d56f7377fde2efce4187.zip |
Apply, suggestions, use strings for actual Mastodon API compatibility
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/admin_api/controllers/rule_controller_test.exs | 4 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/report_controller_test.exs | 17 |
2 files changed, 21 insertions, 0 deletions
diff --git a/test/pleroma/web/admin_api/controllers/rule_controller_test.exs b/test/pleroma/web/admin_api/controllers/rule_controller_test.exs index c5c72d293..96b52b272 100644 --- a/test/pleroma/web/admin_api/controllers/rule_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/rule_controller_test.exs @@ -27,6 +27,10 @@ defmodule Pleroma.Web.AdminAPI.RuleControllerTest do %{id: id2} = Rule.create(%{text: "Second rule", priority: 2}) %{id: id3} = Rule.create(%{text: "Third rule", priority: 1}) + id1 = to_string(id1) + id2 = to_string(id2) + id3 = to_string(id3) + response = conn |> get("/api/pleroma/admin/rules") diff --git a/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs index 77626b821..689a7f375 100644 --- a/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs @@ -65,6 +65,23 @@ defmodule Pleroma.Web.MastodonAPI.ReportControllerTest do assert %Activity{data: %{"rules" => [^rule_id]}} = Activity.get_report(id) end + test "rules field is empty if provided wrong rule id", %{ + conn: conn, + target_user: target_user + } do + assert %{"id" => id} = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/reports", %{ + "account_id" => target_user.id, + "forward" => "false", + "rule_ids" => ["-1"] + }) + |> json_response_and_validate_schema(200) + + assert %Activity{data: %{"rules" => []}} = Activity.get_report(id) + end + test "account_id is required", %{ conn: conn, activity: activity |