summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/controllers/status_controller_test.exs
diff options
context:
space:
mode:
authorMark Felder <feld@FreeBSD.org>2020-07-15 13:34:27 -0500
committerMark Felder <feld@FreeBSD.org>2020-07-15 13:34:27 -0500
commitb2d398b1d04cd2c258e830e3bb5c49c8b294d139 (patch)
treec9cd8e48813bdab768f216b4fb06528f6869d626 /test/web/mastodon_api/controllers/status_controller_test.exs
parent7115c5f82efe1ca1817da3152ba3cbc66e0da1a4 (diff)
parent00f9b53f07346d052adab105bde3428c98fc4660 (diff)
downloadpleroma-b2d398b1d04cd2c258e830e3bb5c49c8b294d139.tar.gz
pleroma-b2d398b1d04cd2c258e830e3bb5c49c8b294d139.zip
Merge branch 'develop' into refactor/gun-pool-registry
Diffstat (limited to 'test/web/mastodon_api/controllers/status_controller_test.exs')
-rw-r--r--test/web/mastodon_api/controllers/status_controller_test.exs13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs
index fd2de8d80..d34f300da 100644
--- a/test/web/mastodon_api/controllers/status_controller_test.exs
+++ b/test/web/mastodon_api/controllers/status_controller_test.exs
@@ -22,6 +22,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
setup do: clear_config([:instance, :federating])
setup do: clear_config([:instance, :allow_relay])
setup do: clear_config([:rich_media, :enabled])
+ setup do: clear_config([:mrf, :policies])
+ setup do: clear_config([:mrf_keyword, :reject])
describe "posting statuses" do
setup do: oauth_access(["write:statuses"])
@@ -157,6 +159,17 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|> json_response_and_validate_schema(422)
end
+ test "Get MRF reason when posting a status is rejected by one", %{conn: conn} do
+ Pleroma.Config.put([:mrf_keyword, :reject], ["GNO"])
+ Pleroma.Config.put([:mrf, :policies], [Pleroma.Web.ActivityPub.MRF.KeywordPolicy])
+
+ assert %{"error" => "[KeywordPolicy] Matches with rejected keyword"} =
+ conn
+ |> put_req_header("content-type", "application/json")
+ |> post("api/v1/statuses", %{"status" => "GNO/Linux"})
+ |> json_response_and_validate_schema(422)
+ end
+
test "posting an undefined status with an attachment", %{user: user, conn: conn} do
file = %Plug.Upload{
content_type: "image/jpg",