-
Notifications
You must be signed in to change notification settings - Fork 3
/
mock.go
141 lines (121 loc) · 4.81 KB
/
mock.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
package mock
import (
"context"
"github.com/SKF/proto/common"
"github.com/SKF/go-eventsource/eventsource"
iam_grpcapi "github.com/SKF/proto/iam"
"github.com/stretchr/testify/mock"
"google.golang.org/grpc"
"github.com/SKF/go-enlight-sdk/services/iam"
)
type client struct {
mock.Mock
}
func Create() *client {
return new(client)
}
var _ iam.IAMClient = &client{}
func (mock *client) Dial(host, port string, opts ...grpc.DialOption) error {
args := mock.Called(host, port, opts)
return args.Error(0)
}
func (mock *client) Close() {
mock.Called()
return
}
func (mock *client) DeepPing() error {
args := mock.Called()
return args.Error(0)
}
func (mock *client) DeepPingWithContext(ctx context.Context) error {
args := mock.Called(ctx)
return args.Error(0)
}
func (mock *client) CheckAuthentication(token, arn string) (iam_grpcapi.User, error) {
args := mock.Called(token, arn)
return args.Get(0).(iam_grpcapi.User), args.Error(1)
}
func (mock *client) CheckAuthenticationWithContext(ctx context.Context, token, arn string) (iam_grpcapi.User, error) {
args := mock.Called(ctx, token, arn)
return args.Get(0).(iam_grpcapi.User), args.Error(1)
}
func (mock *client) CheckAuthenticationByEndpoint(token, api, method, endpoint string) (iam_grpcapi.User, error) {
args := mock.Called(token, api, method, endpoint)
return args.Get(0).(iam_grpcapi.User), args.Error(1)
}
func (mock *client) CheckAuthenticationByEndpointWithContext(ctx context.Context, token, api, method, endpoint string) (iam_grpcapi.User, error) {
args := mock.Called(ctx, token, api, method, endpoint)
return args.Get(0).(iam_grpcapi.User), args.Error(1)
}
func (mock *client) GetNodesByUser(userID string) (nodeIDs []string, err error) {
args := mock.Called(userID)
return args.Get(0).([]string), args.Error(1)
}
func (mock *client) GetNodesByUserWithContext(ctx context.Context, userID string) (nodeIDs []string, err error) {
args := mock.Called(ctx, userID)
return args.Get(0).([]string), args.Error(1)
}
func (mock *client) GetEventRecords(since int, limit *int32) ([]eventsource.Record, error) {
args := mock.Called(since, limit)
return args.Get(0).([]eventsource.Record), args.Error(1)
}
func (mock *client) GetEventRecordsWithContext(ctx context.Context, since int, limit *int32) ([]eventsource.Record, error) {
args := mock.Called(ctx, since, limit)
return args.Get(0).([]eventsource.Record), args.Error(1)
}
func (mock *client) IsAuthorized(userID, action string, resource *common.Origin) (bool, error) {
args := mock.Called(userID, action, resource)
return args.Bool(0), args.Error(1)
}
func (mock *client) IsAuthorizedWithContext(ctx context.Context, userID, action string, resource *common.Origin) (bool, error) {
args := mock.Called(ctx, userID, action, resource)
return args.Bool(0), args.Error(1)
}
func (mock *client) AddAuthorizationResource(resource common.Origin) error {
args := mock.Called(resource)
return args.Error(0)
}
func (mock *client) AddAuthorizationResourceWithContext(ctx context.Context, resource common.Origin) error {
args := mock.Called(ctx, resource)
return args.Error(0)
}
func (mock *client) AddAuthorizationResourceRelation(resource common.Origin, parent common.Origin) error {
args := mock.Called(resource, parent)
return args.Error(0)
}
func (mock *client) AddAuthorizationResourceRelationWithContext(ctx context.Context, resource common.Origin, parent common.Origin) error {
args := mock.Called(ctx, resource, parent)
return args.Error(0)
}
func (mock *client) RemoveAuthorizationResourceRelation(resource common.Origin, parent common.Origin) error {
args := mock.Called(resource, parent)
return args.Error(0)
}
func (mock *client) RemoveAuthorizationResourceRelationWithContext(ctx context.Context, resource common.Origin, parent common.Origin) error {
args := mock.Called(ctx, resource, parent)
return args.Error(0)
}
func (mock *client) RemoveAuthorizationResource(resource common.Origin) error {
args := mock.Called(resource)
return args.Error(0)
}
func (mock *client) RemoveAuthorizationResourceWithContext(ctx context.Context, resource common.Origin) error {
args := mock.Called(ctx, resource)
return args.Error(0)
}
func (mock *client) AddUserPermission(userID, action string, resource common.Origin) error {
args := mock.Called(userID, action, resource)
return args.Error(0)
}
func (mock *client) AddUserPermissionWithContext(ctx context.Context, userID, action string, resource common.Origin) error {
args := mock.Called(ctx, userID, action, resource)
return args.Error(0)
}
func (mock *client) RemoveUserPermission(userID, role string, resource common.Origin) error {
args := mock.Called(userID, role, resource)
return args.Error(0)
}
func (mock *client) RemoveUserPermissionWithContext(ctx context.Context, userID, role string, resource common.Origin) error {
args := mock.Called(ctx, userID, role, resource)
return args.Error(0)
}