logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: ff7a4b6aa2b7a9018074652261d9e0d5dcf6602b
parent 30f140e5702d59ecf8123ddb0959a7a3aefcd3f8
Author: Mark Felder <feld@FreeBSD.org>
Date:   Tue, 17 Nov 2020 20:18:51 +0000

Test that we ignore invalid subscription alert types separately.

Diffstat:

Mtest/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs23+++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs @@ -54,6 +54,26 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do end end + test "ignores unsupported types", %{conn: conn} do + result = + conn + |> post("/api/v1/push/subscription", %{ + "data" => %{ + "alerts" => %{ + "fake_unsupported_type" => true + } + }, + "subscription" => @sub + }) + |> json_response_and_validate_schema(200) + + refute %{ + "alerts" => %{ + "fake_unsupported_type" => true + } + } == result + end + test "successful creation", %{conn: conn} do result = conn @@ -65,8 +85,7 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do "follow" => true, "reblog" => true, "pleroma:chat_mention" => true, - "pleroma:emoji_reaction" => true, - "test" => true + "pleroma:emoji_reaction" => true } }, "subscription" => @sub