mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-04-05 06:07:34 +03:00
WIP
This commit is contained in:
parent
1c0162c434
commit
3863357207
3 changed files with 55 additions and 6 deletions
38
server/server_twilio_test.go
Normal file
38
server/server_twilio_test.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestServer_Twilio_SMS(t *testing.T) {
|
||||
c := newTestConfig(t)
|
||||
c.TwilioBaseURL = "http://"
|
||||
c.TwilioAccount = "AC123"
|
||||
c.TwilioAuthToken = "secret-token"
|
||||
c.TwilioFromNumber = "+123456789"
|
||||
s := newTestServer(t, c)
|
||||
|
||||
response := request(t, s, "POST", "/mytopic", "test", map[string]string{
|
||||
"SMS": "+11122233344",
|
||||
})
|
||||
require.Equal(t, 1, toMessage(t, response.Body.String()).Priority)
|
||||
|
||||
response = request(t, s, "GET", "/mytopic/send?priority=low", "test", nil)
|
||||
require.Equal(t, 2, toMessage(t, response.Body.String()).Priority)
|
||||
|
||||
response = request(t, s, "GET", "/mytopic/send?priority=default", "test", nil)
|
||||
require.Equal(t, 3, toMessage(t, response.Body.String()).Priority)
|
||||
|
||||
response = request(t, s, "GET", "/mytopic/send?priority=high", "test", nil)
|
||||
require.Equal(t, 4, toMessage(t, response.Body.String()).Priority)
|
||||
|
||||
response = request(t, s, "GET", "/mytopic/send?priority=max", "test", nil)
|
||||
require.Equal(t, 5, toMessage(t, response.Body.String()).Priority)
|
||||
|
||||
response = request(t, s, "GET", "/mytopic/trigger?priority=urgent", "test", nil)
|
||||
require.Equal(t, 5, toMessage(t, response.Body.String()).Priority)
|
||||
|
||||
response = request(t, s, "GET", "/mytopic/trigger?priority=INVALID", "test", nil)
|
||||
require.Equal(t, 40007, toHTTPError(t, response.Body.String()).Code)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue