summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2024-01-16 00:56:15 +0000
committerMark Felder <feld@feld.me>2024-01-16 00:59:44 +0000
commit012ab876055e8a045952ee50d760926f88800fd7 (patch)
tree888a5f45f30ac24ca6db68ce7d797da198f1f284 /test
parentad363c62c350bf95e898baed36608d650258cc99 (diff)
Pleroma.Web.MastodonAPI.SubscriptionControllerTest: disable async and use on_exit/1 to ensure web push config gets restored
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs15
1 files changed, 9 insertions, 6 deletions
diff --git a/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs
index ce7cfa9c7..837dc0dce 100644
--- a/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
- use Pleroma.Web.ConnCase, async: true
+ use Pleroma.Web.ConnCase, async: false
import Pleroma.Factory
@@ -35,17 +35,20 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
defmacro assert_error_when_disable_push(do: yield) do
quote do
- vapid_details = Application.get_env(:web_push_encryption, :vapid_details, [])
- Application.put_env(:web_push_encryption, :vapid_details, [])
-
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
describe "when disabled" do
+ setup do
+ vapid_config = Application.get_env(:web_push_encryption, :vapid_details)
+
+ Application.put_env(:web_push_encryption, :vapid_details, [])
+
+ on_exit(fn -> Application.put_env(:web_push_encryption, :vapid_details, vapid_config) end)
+ end
+
test "POST returns error", %{conn: conn} do
assert_error_when_disable_push do
conn