2023-05-29 18:57:21 +03:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/urfave/cli/v2"
|
|
|
|
"heckel.io/ntfy/server"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestCLI_WebPush_GenerateKeys(t *testing.T) {
|
|
|
|
app, _, _, stderr := newTestApp()
|
2023-06-08 21:30:19 +03:00
|
|
|
require.Nil(t, runWebPushCommand(app, server.NewConfig(), "keys"))
|
|
|
|
require.Contains(t, stderr.String(), "Web Push keys generated.")
|
2023-05-29 18:57:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func runWebPushCommand(app *cli.App, conf *server.Config, args ...string) error {
|
|
|
|
webPushArgs := []string{
|
|
|
|
"ntfy",
|
|
|
|
"--log-level=ERROR",
|
2023-06-08 21:30:19 +03:00
|
|
|
"webpush",
|
2023-05-29 18:57:21 +03:00
|
|
|
}
|
|
|
|
return app.Run(append(webPushArgs, args...))
|
|
|
|
}
|