aboutsummaryrefslogtreecommitdiff
path: root/test/pleroma/web/mastodon_api/views/subscription_view_test.exs
diff options
context:
space:
mode:
authordcc <dcc@logografos.com>2023-09-02 00:52:52 -0700
committerdcc <dcc@logografos.com>2023-09-02 00:52:52 -0700
commit3a4773c3c2bd0bbef244eb519b07208da9108e49 (patch)
tree973567a6f3abb37bfb0f785b1cad14ed55840ef5 /test/pleroma/web/mastodon_api/views/subscription_view_test.exs
downloadanni-3a4773c3c2bd0bbef244eb519b07208da9108e49.tar.gz
anni-3a4773c3c2bd0bbef244eb519b07208da9108e49.tar.bz2
anni-3a4773c3c2bd0bbef244eb519b07208da9108e49.zip
First
Diffstat (limited to 'test/pleroma/web/mastodon_api/views/subscription_view_test.exs')
-rw-r--r--test/pleroma/web/mastodon_api/views/subscription_view_test.exs23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/pleroma/web/mastodon_api/views/subscription_view_test.exs b/test/pleroma/web/mastodon_api/views/subscription_view_test.exs
new file mode 100644
index 0000000..fd4cd96
--- /dev/null
+++ b/test/pleroma/web/mastodon_api/views/subscription_view_test.exs
@@ -0,0 +1,23 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Web.MastodonAPI.SubscriptionViewTest do
+ use Pleroma.DataCase, async: true
+ import Pleroma.Factory
+ alias Pleroma.Web.MastodonAPI.SubscriptionView, as: View
+ alias Pleroma.Web.Push
+
+ test "Represent a subscription" do
+ subscription = insert(:push_subscription, data: %{"alerts" => %{"mention" => true}})
+
+ expected = %{
+ alerts: %{"mention" => true},
+ endpoint: subscription.endpoint,
+ id: to_string(subscription.id),
+ server_key: Keyword.get(Push.vapid_config(), :public_key)
+ }
+
+ assert expected == View.render("show.json", %{subscription: subscription})
+ end
+end