mirror of
https://github.com/gopasspw/gopass.git
synced 2026-09-29 11:12:40 +02:00
This commit adds yet another config handler for gopass. It is based on the format used by git itself. This has the potential to address a lot of long standing issues, but it also causes a lot of changes to how we handle configuration, so bugs are inevitable. Fixes #1567 Fixes #1764 Fixes #1819 Fixes #1878 Fixes #2387 RELEASE_NOTES=[BREAKING] New config format based on git config. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> Co-authored-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>
45 lines
1.0 KiB
Go
45 lines
1.0 KiB
Go
package action
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/gopasspw/gopass/internal/out"
|
|
"github.com/gopasspw/gopass/pkg/ctxutil"
|
|
"github.com/gopasspw/gopass/tests/gptest"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestSync(t *testing.T) { //nolint:paralleltest
|
|
u := gptest.NewUnitTester(t)
|
|
defer u.Remove()
|
|
|
|
buf := &bytes.Buffer{}
|
|
out.Stdout = buf
|
|
out.Stderr = buf
|
|
defer func() {
|
|
out.Stdout = os.Stdout
|
|
out.Stderr = os.Stderr
|
|
}()
|
|
|
|
ctx := context.Background()
|
|
ctx = ctxutil.WithAlwaysYes(ctx, true)
|
|
act, err := newMock(ctx, u.StoreDir(""))
|
|
require.NoError(t, err)
|
|
require.NotNil(t, act)
|
|
ctx = act.cfg.WithConfig(ctx)
|
|
|
|
t.Run("default", func(t *testing.T) { //nolint:paralleltest
|
|
defer buf.Reset()
|
|
assert.NoError(t, act.Sync(gptest.CliCtx(ctx, t)))
|
|
})
|
|
|
|
t.Run("sync --store=root", func(t *testing.T) { //nolint:paralleltest
|
|
defer buf.Reset()
|
|
assert.NoError(t, act.Sync(gptest.CliCtxWithFlags(ctx, t, map[string]string{"store": "root"})))
|
|
})
|
|
}
|