1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-06-02 03:20:34 +02:00

Do not print ugly WS error; tests

This commit is contained in:
Philipp Heckel 2022-01-15 22:33:35 -05:00
parent 846ee0fb2d
commit 707c58a120
9 changed files with 204 additions and 65 deletions

View file

@ -5,6 +5,7 @@ import (
"heckel.io/ntfy/server"
"math/rand"
"net/http"
"path/filepath"
"testing"
"time"
)
@ -22,6 +23,8 @@ func StartServer(t *testing.T) (*server.Server, int) {
func StartServerWithConfig(t *testing.T, conf *server.Config) (*server.Server, int) {
port := 10000 + rand.Intn(20000)
conf.ListenHTTP = fmt.Sprintf(":%d", port)
conf.AttachmentCacheDir = t.TempDir()
conf.CacheFile = filepath.Join(t.TempDir(), "cache.db")
s, err := server.New(conf)
if err != nil {
t.Fatal(err)