diff options
| author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-04-02 15:41:30 +0700 |
|---|---|---|
| committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-04-02 15:41:30 +0700 |
| commit | a1869f5272ddd83cdf2b2fc487668de79f2d0c6d (patch) | |
| tree | def42bef14e8ced310471a194080e38cbee15452 /test/web/mastodon_api/push_subscription_view_test.exs | |
| parent | 16e598ec11cb9178b9fc53a1ec4b649d97c5f3b8 (diff) | |
| parent | f8aa917eef9280631a5cd2c95cf1db8fab6e14e5 (diff) | |
| download | pleroma-a1869f5272ddd83cdf2b2fc487668de79f2d0c6d.tar.gz pleroma-a1869f5272ddd83cdf2b2fc487668de79f2d0c6d.zip | |
Merge remote-tracking branch 'pleroma/develop' into remove-user-activities
Diffstat (limited to 'test/web/mastodon_api/push_subscription_view_test.exs')
| -rw-r--r-- | test/web/mastodon_api/push_subscription_view_test.exs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/web/mastodon_api/push_subscription_view_test.exs b/test/web/mastodon_api/push_subscription_view_test.exs new file mode 100644 index 000000000..dc935fc82 --- /dev/null +++ b/test/web/mastodon_api/push_subscription_view_test.exs @@ -0,0 +1,23 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.MastodonAPI.PushSubscriptionViewTest do + use Pleroma.DataCase + import Pleroma.Factory + alias Pleroma.Web.MastodonAPI.PushSubscriptionView, 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("push_subscription.json", %{subscription: subscription}) + end +end |
