webpush_test.go 556 B

123456789101112131415161718192021222324
  1. package cmd
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/require"
  5. "github.com/urfave/cli/v2"
  6. "heckel.io/ntfy/server"
  7. )
  8. func TestCLI_WebPush_GenerateKeys(t *testing.T) {
  9. app, _, _, stderr := newTestApp()
  10. require.Nil(t, runWebPushCommand(app, server.NewConfig(), "keys"))
  11. require.Contains(t, stderr.String(), "Web Push keys generated.")
  12. }
  13. func runWebPushCommand(app *cli.App, conf *server.Config, args ...string) error {
  14. webPushArgs := []string{
  15. "ntfy",
  16. "--log-level=ERROR",
  17. "webpush",
  18. }
  19. return app.Run(append(webPushArgs, args...))
  20. }