From 3cd61d82780baccf2aebfbf2330000e57ac6a02e Mon Sep 17 00:00:00 2001 From: nimbleghost <132819643+nimbleghost@users.noreply.github.com> Date: Sat, 17 Jun 2023 21:44:21 +0200 Subject: [PATCH] Add web push delete test --- server/server_webpush_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/server_webpush_test.go b/server/server_webpush_test.go index 72cd9f30..c0db79c6 100644 --- a/server/server_webpush_test.go +++ b/server/server_webpush_test.go @@ -78,6 +78,19 @@ func TestServer_WebPush_TopicUnsubscribe(t *testing.T) { requireSubscriptionCount(t, s, "test-topic", 0) } +func TestServer_WebPush_Delete(t *testing.T) { + s := newTestServer(t, newTestConfigWithWebPush(t)) + + addSubscription(t, s, testWebPushEndpoint, "test-topic") + requireSubscriptionCount(t, s, "test-topic", 1) + + response := request(t, s, "DELETE", "/v1/webpush", fmt.Sprintf(`{"endpoint":"%s"}`, testWebPushEndpoint), nil) + require.Equal(t, 200, response.Code) + require.Equal(t, `{"success":true}`+"\n", response.Body.String()) + + requireSubscriptionCount(t, s, "test-topic", 0) +} + func TestServer_WebPush_TopicSubscribeProtected_Allowed(t *testing.T) { config := configureAuth(t, newTestConfigWithWebPush(t)) config.AuthDefault = user.PermissionDenyAll