1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-06-11 15:19:02 +02:00

More tests; enough!

This commit is contained in:
Philipp Heckel 2022-02-03 22:26:22 -05:00
parent 4972407145
commit 3902599c52
4 changed files with 111 additions and 12 deletions

View file

@ -121,6 +121,16 @@ func newTestServerWithAuth(t *testing.T) (s *server.Server, conf *server.Config,
}
func runUserCommand(app *cli.App, conf *server.Config, args ...string) error {
userArgs := []string{
"ntfy",
"user",
"--auth-file=" + conf.AuthFile,
"--auth-default-access=" + confToDefaultAccess(conf),
}
return app.Run(append(userArgs, args...))
}
func confToDefaultAccess(conf *server.Config) string {
var defaultAccess string
if conf.AuthDefaultRead && conf.AuthDefaultWrite {
defaultAccess = "read-write"
@ -131,11 +141,5 @@ func runUserCommand(app *cli.App, conf *server.Config, args ...string) error {
} else if !conf.AuthDefaultRead && !conf.AuthDefaultWrite {
defaultAccess = "deny-all"
}
userArgs := []string{
"ntfy",
"user",
"--auth-file=" + conf.AuthFile,
"--auth-default-access=" + defaultAccess,
}
return app.Run(append(userArgs, args...))
return defaultAccess
}