mirror of
https://github.com/gopasspw/gopass.git
synced 2025-12-08 19:24:54 +00:00
* [chore] Migrate to golangci-lint v2 Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [chore] Fix more lint issues Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [chore] Fix more lint issue Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [chore] Fix more lint issues Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [chore] Add more package comments. Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [chore] Fix golangci-lint config and the remaining checks Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Use Go 1.24 Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Fix container builds Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * Fix more failing tests Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * Fix test failure Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * Fix another len assertion Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * Move location tests Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Fix most remaining lint issues Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Only run XDG specific tests on linux Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> * [fix] Attempt to address on source of flaky failures Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org> --------- Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
48 lines
872 B
Go
48 lines
872 B
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/gopasspw/gopass/pkg/termio"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestNew(t *testing.T) {
|
|
client := New()
|
|
assert.NotNil(t, client)
|
|
assert.False(t, client.repeat)
|
|
}
|
|
|
|
func TestSet(t *testing.T) {
|
|
client := New()
|
|
|
|
err := client.Set("REPEAT")
|
|
require.NoError(t, err)
|
|
assert.True(t, client.repeat)
|
|
|
|
err = client.Set("OTHER")
|
|
require.NoError(t, err)
|
|
assert.True(t, client.repeat)
|
|
}
|
|
|
|
func TestOption(t *testing.T) {
|
|
client := New()
|
|
|
|
err := client.Option("ANY")
|
|
require.NoError(t, err)
|
|
}
|
|
|
|
func TestGetPIN(t *testing.T) {
|
|
client := New()
|
|
|
|
ctx := termio.WithPassPromptFunc(t.Context(), func(ctx context.Context, s string) (string, error) {
|
|
return "1234", nil
|
|
})
|
|
|
|
pin, err := client.GetPINContext(ctx)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, "1234", pin)
|
|
}
|