photoprism/internal/commands/auth_test.go
Michael Mayer 713593da4e Auth: Add CLI command to create access tokens for apps #782 #808 #3943
You can now run "photoprism auth add" to create new client access tokens
that allow external applications to use the built-in REST API.

Signed-off-by: Michael Mayer <michael@photoprism.app>
2024-01-05 16:31:07 +01:00

31 lines
557 B
Go

package commands
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/photoprism/photoprism/internal/config"
"github.com/photoprism/photoprism/pkg/capture"
)
func TestAuthListCommand(t *testing.T) {
var err error
ctx := config.CliTestContext()
output := capture.Output(func() {
err = AuthListCommand.Run(ctx)
})
if err != nil {
t.Fatal(err)
}
t.Logf(output)
// Check the command output for plausibility.
assert.Contains(t, output, "alice")
assert.Contains(t, output, "bob")
assert.Contains(t, output, "visitor")
}