-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Expand file tree
/
Copy pathkeyring_linux_test.go
More file actions
51 lines (45 loc) · 958 Bytes
/
Copy pathkeyring_linux_test.go
File metadata and controls
51 lines (45 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//go:build linux
// +build linux
package keyring
import (
"errors"
"io"
"strings"
"testing"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/codec"
)
func TestNewKeyctlKeyring(t *testing.T) {
cdc := getCodec()
tests := []struct {
name string
appName string
backend string
dir string
userInput io.Reader
cdc codec.Codec
expectedErr error
}{
{
name: "keyctl backend",
appName: "cosmos",
backend: BackendKeyctl,
dir: t.TempDir(),
userInput: strings.NewReader(""),
cdc: cdc,
expectedErr: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
kr, err := New(tt.appName, tt.backend, tt.dir, tt.userInput, tt.cdc)
if tt.expectedErr == nil {
require.NoError(t, err)
} else {
require.Error(t, err)
require.Nil(t, kr)
require.True(t, errors.Is(err, tt.expectedErr))
}
})
}
}