diff options
| author | kaniini <nenolod@gmail.com> | 2019-03-06 13:20:12 +0000 |
|---|---|---|
| committer | kaniini <nenolod@gmail.com> | 2019-03-06 13:20:12 +0000 |
| commit | d249ea8e7c216d82cc059e130704618406e80084 (patch) | |
| tree | 949a440fd0cbeda1a37ecd3022d891345322de64 /test/web/mastodon_api/push_subscription_view_test.exs | |
| parent | 4cbaab2181e7dd5e471b78481997fa4ad049e192 (diff) | |
| parent | bc7570c282ea45d2d0d4b44c4a07b5d0bda2fea8 (diff) | |
| download | pleroma-d249ea8e7c216d82cc059e130704618406e80084.tar.gz pleroma-d249ea8e7c216d82cc059e130704618406e80084.zip | |
Merge branch 'feature/647' into 'develop'
[#647] tests for web push
See merge request pleroma/pleroma!904
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 |
