Test that we ignore invalid subscription alert types separately.
authorMark Felder <feld@FreeBSD.org>
Tue, 17 Nov 2020 20:18:51 +0000 (20:18 +0000)
committerMark Felder <feld@FreeBSD.org>
Tue, 17 Nov 2020 20:22:25 +0000 (20:22 +0000)
test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs

index 3792609655d3e488ce48ac314e7919ef5429a341..9e021a2b64d5d6d0f07a956aacc428aeb2b4e544 100644 (file)
@@ -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