Files
photoprism/internal/commands/passwd_test.go
2024-12-09 15:11:39 +01:00

35 lines
944 B
Go

package commands
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestPasswdCommand(t *testing.T) {
t.Run("UserNotFound", func(t *testing.T) {
// Run command with test context.
output, err := RunWithTestContext(PasswdCommand, []string{"passwd", "--show", "mila"})
// Check command output for plausibility.
assert.Error(t, err)
assert.Empty(t, output)
})
t.Run("DeletedUser", func(t *testing.T) {
// Run command with test context.
output, err := RunWithTestContext(PasswdCommand, []string{"passwd", "--show", "uqxqg7i1kperxvu8"})
// Check command output for plausibility.
assert.Error(t, err)
assert.Empty(t, output)
})
t.Run("DeletePassword", func(t *testing.T) {
// Run command with test context.
output, err := RunWithTestContext(PasswdCommand, []string{"passwd", "--rm", "no_local_auth"})
// Check command output for plausibility.
assert.NoError(t, err)
assert.Empty(t, output)
})
}