项目文件夹

文件
2026-07-13 12:27:58 +08:00

29 行
540 B
Go

package editor
import (
"bytes"
"os"
"testing"
"github.com/gopasspw/gopass/internal/config"
"github.com/gopasspw/gopass/internal/out"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/stretchr/testify/require"
)
func TestEdit(t *testing.T) {
ctx := config.NewContextInMemory()
ctx = ctxutil.WithAlwaysYes(ctx, true)
ctx = ctxutil.WithTerminal(ctx, false)
buf := &bytes.Buffer{}
out.Stdout = buf
defer func() {
out.Stdout = os.Stdout
}()
_, err := Invoke(ctx, "true", []byte{})
require.Error(t, err)
buf.Reset()
}