gopass/internal/cui/cui_test.go
Dominik Schulz 263b78119b
[bugfix] Fix writes to global config from tests (#2727)
* [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>
2023-12-01 14:04:17 +01:00

21 lines
421 B
Go

package cui
import (
"testing"
"github.com/gopasspw/gopass/internal/config"
"github.com/gopasspw/gopass/pkg/ctxutil"
"github.com/stretchr/testify/assert"
)
func TestGetSelection(t *testing.T) {
t.Parallel()
ctx := config.NewContextInMemory()
ctx = ctxutil.WithInteractive(ctx, false)
act, sel := GetSelection(ctx, "foo", []string{"foo", "bar"})
assert.Equal(t, "impossible", act)
assert.Equal(t, 0, sel)
}