photoprism/internal/commands/users_remove_test.go
Michael Mayer a4e2bb33b9 2FA: Rename "Auth Secret" to "App Password" for more clarity #782 #808
Signed-off-by: Michael Mayer <michael@photoprism.app>
2024-01-19 18:10:01 +01:00

43 lines
989 B
Go

package commands
import (
"testing"
"github.com/photoprism/photoprism/pkg/capture"
"github.com/stretchr/testify/assert"
)
func TestUsersRemoveCommand(t *testing.T) {
t.Run("RemoveNotExistingUser", func(t *testing.T) {
var err error
// Create test context with flags and arguments.
ctx := NewTestContext([]string{"rm", "uqxqg7i1kperxxx0"})
// Run command with test context.
output := capture.Output(func() {
err = UsersRemoveCommand.Run(ctx)
})
// Check command output for plausibility.
// t.Logf(output)
assert.Error(t, err)
assert.Empty(t, output)
})
t.Run("RemoveDeletedUser", func(t *testing.T) {
var err error
// Create test context with flags and arguments.
ctx := NewTestContext([]string{"rm", "deleted"})
// Run command with test context.
output := capture.Output(func() {
err = UsersRemoveCommand.Run(ctx)
})
// Check command output for plausibility.
// t.Logf(output)
assert.Error(t, err)
assert.Empty(t, output)
})
}