Reblog content should be ""
[akkoma] / test / pleroma / web / mastodon_api / views / subscription_view_test.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.MastodonAPI.SubscriptionViewTest do
6 use Pleroma.DataCase, async: true
7 import Pleroma.Factory
8 alias Pleroma.Web.MastodonAPI.SubscriptionView, as: View
9 alias Pleroma.Web.Push
10
11 test "Represent a subscription" do
12 subscription = insert(:push_subscription, data: %{"alerts" => %{"mention" => true}})
13
14 expected = %{
15 alerts: %{"mention" => true},
16 endpoint: subscription.endpoint,
17 id: to_string(subscription.id),
18 server_key: Keyword.get(Push.vapid_config(), :public_key)
19 }
20
21 assert expected == View.render("show.json", %{subscription: subscription})
22 end
23 end