2019-03-06 13:20:12 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2021-01-13 06:49:20 +00:00
|
|
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
2019-03-06 13:20:12 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-04-15 18:59:25 +00:00
|
|
|
defmodule Pleroma.Web.MastodonAPI.SubscriptionViewTest do
|
2020-12-21 11:21:40 +00:00
|
|
|
use Pleroma.DataCase, async: true
|
2019-03-06 13:20:12 +00:00
|
|
|
import Pleroma.Factory
|
2020-04-15 18:59:25 +00:00
|
|
|
alias Pleroma.Web.MastodonAPI.SubscriptionView, as: View
|
2019-03-06 13:20:12 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2020-04-15 18:59:25 +00:00
|
|
|
assert expected == View.render("show.json", %{subscription: subscription})
|
2019-03-06 13:20:12 +00:00
|
|
|
end
|
|
|
|
end
|