Merge branch 'cleanup-subscription-controller' into 'develop'
Cleanup SubscriptionController See merge request pleroma/pleroma!2393
This commit is contained in:
commit
28165dad3a
4 changed files with 31 additions and 26 deletions
|
|
@ -35,7 +35,10 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
quote do
|
||||
vapid_details = Application.get_env(:web_push_encryption, :vapid_details, [])
|
||||
Application.put_env(:web_push_encryption, :vapid_details, [])
|
||||
assert "Something went wrong" == unquote(yield)
|
||||
|
||||
assert %{"error" => "Web push subscription is disabled on this Pleroma instance"} ==
|
||||
unquote(yield)
|
||||
|
||||
Application.put_env(:web_push_encryption, :vapid_details, vapid_details)
|
||||
end
|
||||
end
|
||||
|
|
@ -45,7 +48,7 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
assert_error_when_disable_push do
|
||||
conn
|
||||
|> post("/api/v1/push/subscription", %{})
|
||||
|> json_response(500)
|
||||
|> json_response(403)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -74,7 +77,7 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
assert_error_when_disable_push do
|
||||
conn
|
||||
|> get("/api/v1/push/subscription", %{})
|
||||
|> json_response(500)
|
||||
|> json_response(403)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -127,7 +130,7 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
assert_error_when_disable_push do
|
||||
conn
|
||||
|> put("/api/v1/push/subscription", %{data: %{"alerts" => %{"mention" => false}}})
|
||||
|> json_response(500)
|
||||
|> json_response(403)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -155,7 +158,7 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
assert_error_when_disable_push do
|
||||
conn
|
||||
|> delete("/api/v1/push/subscription", %{})
|
||||
|> json_response(500)
|
||||
|> json_response(403)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.MastodonAPI.PushSubscriptionViewTest do
|
||||
defmodule Pleroma.Web.MastodonAPI.SubscriptionViewTest do
|
||||
use Pleroma.DataCase
|
||||
import Pleroma.Factory
|
||||
alias Pleroma.Web.MastodonAPI.PushSubscriptionView, as: View
|
||||
alias Pleroma.Web.MastodonAPI.SubscriptionView, as: View
|
||||
alias Pleroma.Web.Push
|
||||
|
||||
test "Represent a subscription" do
|
||||
|
|
@ -18,6 +18,6 @@ defmodule Pleroma.Web.MastodonAPI.PushSubscriptionViewTest do
|
|||
server_key: Keyword.get(Push.vapid_config(), :public_key)
|
||||
}
|
||||
|
||||
assert expected == View.render("push_subscription.json", %{subscription: subscription})
|
||||
assert expected == View.render("show.json", %{subscription: subscription})
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue