package commands import ( "testing" "github.com/photoprism/photoprism/pkg/capture" "github.com/stretchr/testify/assert" ) func TestAuthShowCommand(t *testing.T) { t.Run("All", func(t *testing.T) { var err error // Create test context with flags and arguments. ctx := NewTestContext([]string{"show", "sess34q3hael"}) // Run command with test context. output := capture.Output(func() { err = AuthShowCommand.Run(ctx) }) // Check command output for plausibility. // t.Logf(output) assert.NoError(t, err) assert.Contains(t, output, "alice") assert.Contains(t, output, "access_token") assert.Contains(t, output, "Client") }) t.Run("NoResult", func(t *testing.T) { var err error // Create test context with flags and arguments. ctx := NewTestContext([]string{"show", "sess34qxxxxx"}) // Run command with test context. output := capture.Output(func() { err = AuthShowCommand.Run(ctx) }) // Check command output for plausibility. // t.Logf(output) assert.Error(t, err) assert.Empty(t, output) }) }