mirror of
https://github.com/gopasspw/gopass.git
synced 2025-12-08 19:24:54 +00:00
* [bugfix] Fix writes to global config from tests Fixes #2725 Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * Shorten readonly config creation. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * Address review comments Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> --------- Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
29 lines
540 B
Go
29 lines
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()
|
|
}
|