From 8a56b82813539b8ebbaa9a6aaa258219d0f6b8f2 Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Thu, 16 Jun 2022 12:42:19 -0400 Subject: [PATCH] 500-test --- server/server.yml | 8 ++++++-- server/server_test.go | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/server/server.yml b/server/server.yml index 01a212d0..65f1db3c 100644 --- a/server/server.yml +++ b/server/server.yml @@ -4,8 +4,12 @@ # All options also support underscores (_) instead of dashes (-) to comply with the YAML spec. # Public facing base URL of the service (e.g. https://ntfy.sh or https://ntfy.example.com) -# This setting is currently only used by attachments, e-mail sending (outgoing mail only), as well -# as in combination with upstream-base-url (for iOS push notifications for self-hosted servers). +# +# This setting is required for any of the following features: +# - attachments (to return a download URL) +# - e-mail sending (for the topic URL in the email footer) +# - iOS push notifications for self-hosted servers (to calculate the Firebase poll_request topic) +# - Matrix Push Gateway (to validate that the pushkey is correct) # # base-url: diff --git a/server/server_test.go b/server/server_test.go index c9af9459..55125c3e 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -949,6 +949,18 @@ func TestServer_MatrixGateway_Push_Failure_EverythingIsWrong(t *testing.T) { require.Equal(t, 400, err.HTTPCode) } +func TestServer_MatrixGateway_Push_Failure_Unconfigured(t *testing.T) { + c := newTestConfig(t) + c.BaseURL = "" + s := newTestServer(t, c) + notification := `{"notification":{"devices":[{"pushkey":"http://127.0.0.1:12345/mytopic?up=1"}]}}` + response := request(t, s, "POST", "/_matrix/push/v1/notify", notification, nil) + require.Equal(t, 500, response.Code) + err := toHTTPError(t, response.Body.String()) + require.Equal(t, 50003, err.Code) + require.Equal(t, 500, err.HTTPCode) +} + func TestServer_PublishActions_AndPoll(t *testing.T) { s := newTestServer(t, newTestConfig(t)) response := request(t, s, "PUT", "/mytopic", "my message", map[string]string{