mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-23 15:05:45 +00:00
9ba60f70d2
In general, tests that match these criteria can be made async: - Doesn't use real Cachex. - Doesn't write to the Config / Application Environment. - Uses Mock. Using Mox is fine. - Uses the streamer.
24 lines
781 B
Elixir
24 lines
781 B
Elixir
# Pleroma: A lightweight social networking server
|
|
# Copyright © 2017-2020 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
|