mirror of
https://github.com/gopasspw/gopass.git
synced 2026-05-30 11:18:48 +02:00
ed54973318
* Adding regression test Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com> * fixing recipient logic to honor subkeys Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com> * Revert "Adding regression test" This reverts commit fcb85c9d2ee4ce3b1d53f934338c6a33e18d7d9d. Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com> * adding comment about noop Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com> * Linting Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com> * Addressing review comments Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com> * avoid noise debug logs Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com> --------- Signed-off-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>
46 lines
1.0 KiB
Go
46 lines
1.0 KiB
Go
package leaf
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/gopasspw/gopass/internal/config"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestFsckCheck(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
ctx := config.NewContextInMemory()
|
|
|
|
assert.False(t, IsFsckCheck(ctx))
|
|
assert.True(t, IsFsckCheck(WithFsckCheck(ctx, true)))
|
|
assert.False(t, IsFsckCheck(WithFsckCheck(ctx, false)))
|
|
assert.True(t, HasFsckCheck(WithFsckCheck(ctx, true)))
|
|
}
|
|
|
|
func TestFsckForce(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
ctx := config.NewContextInMemory()
|
|
|
|
assert.False(t, IsFsckForce(ctx))
|
|
assert.True(t, IsFsckForce(WithFsckForce(ctx, true)))
|
|
assert.False(t, IsFsckForce(WithFsckForce(ctx, false)))
|
|
assert.True(t, HasFsckForce(WithFsckForce(ctx, true)))
|
|
}
|
|
|
|
func TestFsckFunc(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
ctx := config.NewContextInMemory()
|
|
|
|
ffunc := func(context.Context, string) bool {
|
|
return true
|
|
}
|
|
assert.NotNil(t, GetFsckFunc(ctx))
|
|
assert.True(t, GetFsckFunc(ctx)(ctx, ""))
|
|
assert.True(t, GetFsckFunc(WithFsckFunc(ctx, ffunc))(ctx, ""))
|
|
assert.True(t, HasFsckFunc(WithFsckFunc(ctx, ffunc)))
|
|
}
|