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

Make sure tokens are updated instead of deleted/re-added

This commit is contained in:
binwiederhier 2025-07-31 08:36:05 +02:00
parent b91ff5f0b5
commit 9f987e66fa
3 changed files with 197 additions and 100 deletions

View file

@ -1,6 +1,7 @@
package cmd
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/require"
@ -15,10 +16,12 @@ func TestCLI_WebPush_GenerateKeys(t *testing.T) {
}
func TestCLI_WebPush_WriteKeysToFile(t *testing.T) {
tempDir := t.TempDir()
t.Chdir(tempDir)
app, _, _, stderr := newTestApp()
require.Nil(t, runWebPushCommand(app, server.NewConfig(), "keys", "--output-file=key-file.yaml"))
require.Contains(t, stderr.String(), "Web Push keys written to key-file.yaml")
require.FileExists(t, "key-file.yaml")
require.FileExists(t, filepath.Join(tempDir, "key-file.yaml"))
}
func runWebPushCommand(app *cli.App, conf *server.Config, args ...string) error {