mirror of
https://github.com/gopasspw/gopass.git
synced 2025-12-08 19:24:54 +00:00
* [feat] Replace clipboard library to support wl-copy args This change should allow us to protect sensitive content from being captured in some clipboard managers on KDE. Fixes #2611 Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [chore] Update clipboard dep Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Update clipboard Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> --------- Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
44 lines
908 B
Go
44 lines
908 B
Go
package action
|
|
|
|
import (
|
|
"bytes"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/gopasspw/clipboard"
|
|
"github.com/gopasspw/gopass/internal/config"
|
|
"github.com/gopasspw/gopass/internal/out"
|
|
"github.com/gopasspw/gopass/pkg/ctxutil"
|
|
"github.com/gopasspw/gopass/tests/gptest"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestCreate(t *testing.T) {
|
|
u := gptest.NewUnitTester(t)
|
|
|
|
clipboard.ForceUnsupported = true
|
|
|
|
ctx := config.NewContextInMemory()
|
|
ctx = ctxutil.WithAlwaysYes(ctx, true)
|
|
|
|
act, err := newMock(ctx, u.StoreDir(""))
|
|
require.NoError(t, err)
|
|
require.NotNil(t, act)
|
|
ctx = act.cfg.WithConfig(ctx)
|
|
|
|
require.NoError(t, act.cfg.Set("", "core.notifications", "false"))
|
|
require.NoError(t, act.cfg.Set("", "core.cliptimeout", "1"))
|
|
|
|
buf := &bytes.Buffer{}
|
|
out.Stdout = buf
|
|
defer func() {
|
|
out.Stdout = os.Stdout
|
|
}()
|
|
|
|
// create
|
|
c := gptest.CliCtx(ctx, t)
|
|
|
|
require.Error(t, act.Create(c))
|
|
buf.Reset()
|
|
}
|