-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmocks_test.go
60 lines (46 loc) · 1.53 KB
/
mocks_test.go
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
52
53
54
55
56
57
58
59
60
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package openldap
import (
"context"
"github.com/go-ldap/ldif"
"github.com/hashicorp/vault-plugin-secrets-openldap/client"
"github.com/hashicorp/vault/sdk/logical"
"github.com/stretchr/testify/mock"
)
var _ ldapClient = (*mockLDAPClient)(nil)
type mockLDAPClient struct {
mock.Mock
}
func (m *mockLDAPClient) UpdateDNPassword(conf *client.Config, dn string, newPassword string) error {
args := m.Called(conf, dn, newPassword)
return args.Error(0)
}
func (m *mockLDAPClient) UpdateUserPassword(conf *client.Config, user string, newPassword string) error {
args := m.Called(conf, user, newPassword)
return args.Error(0)
}
func (m *mockLDAPClient) Execute(conf *client.Config, entries []*ldif.Entry, continueOnError bool) (err error) {
args := m.Called(conf, entries, continueOnError)
return args.Error(0)
}
var _ logical.Storage = (*mockStorage)(nil)
type mockStorage struct {
mock.Mock
}
func (m *mockStorage) List(ctx context.Context, s string) ([]string, error) {
args := m.Called(ctx, s)
return args.Get(0).([]string), args.Error(1)
}
func (m *mockStorage) Get(ctx context.Context, s string) (*logical.StorageEntry, error) {
args := m.Called(ctx, s)
return args.Get(0).(*logical.StorageEntry), args.Error(1)
}
func (m *mockStorage) Put(ctx context.Context, entry *logical.StorageEntry) error {
args := m.Called(ctx, entry)
return args.Error(0)
}
func (m *mockStorage) Delete(ctx context.Context, s string) error {
args := m.Called(ctx, s)
return args.Error(0)
}