forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmocks.go
294 lines (241 loc) · 10 KB
/
mocks.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
// Code generated by mockery v2.35.2. DO NOT EDIT.
package tests
import (
context "context"
apikey "github.com/grafana/grafana/pkg/services/apikey"
mock "github.com/stretchr/testify/mock"
serviceaccounts "github.com/grafana/grafana/pkg/services/serviceaccounts"
)
// MockServiceAccountService is an autogenerated mock type for the Service type
type MockServiceAccountService struct {
mock.Mock
}
// AddServiceAccountToken provides a mock function with given fields: ctx, serviceAccountID, cmd
func (_m *MockServiceAccountService) AddServiceAccountToken(ctx context.Context, serviceAccountID int64, cmd *serviceaccounts.AddServiceAccountTokenCommand) (*apikey.APIKey, error) {
ret := _m.Called(ctx, serviceAccountID, cmd)
var r0 *apikey.APIKey
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, int64, *serviceaccounts.AddServiceAccountTokenCommand) (*apikey.APIKey, error)); ok {
return rf(ctx, serviceAccountID, cmd)
}
if rf, ok := ret.Get(0).(func(context.Context, int64, *serviceaccounts.AddServiceAccountTokenCommand) *apikey.APIKey); ok {
r0 = rf(ctx, serviceAccountID, cmd)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*apikey.APIKey)
}
}
if rf, ok := ret.Get(1).(func(context.Context, int64, *serviceaccounts.AddServiceAccountTokenCommand) error); ok {
r1 = rf(ctx, serviceAccountID, cmd)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CreateServiceAccount provides a mock function with given fields: ctx, orgID, saForm
func (_m *MockServiceAccountService) CreateServiceAccount(ctx context.Context, orgID int64, saForm *serviceaccounts.CreateServiceAccountForm) (*serviceaccounts.ServiceAccountDTO, error) {
ret := _m.Called(ctx, orgID, saForm)
var r0 *serviceaccounts.ServiceAccountDTO
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, int64, *serviceaccounts.CreateServiceAccountForm) (*serviceaccounts.ServiceAccountDTO, error)); ok {
return rf(ctx, orgID, saForm)
}
if rf, ok := ret.Get(0).(func(context.Context, int64, *serviceaccounts.CreateServiceAccountForm) *serviceaccounts.ServiceAccountDTO); ok {
r0 = rf(ctx, orgID, saForm)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*serviceaccounts.ServiceAccountDTO)
}
}
if rf, ok := ret.Get(1).(func(context.Context, int64, *serviceaccounts.CreateServiceAccountForm) error); ok {
r1 = rf(ctx, orgID, saForm)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeleteServiceAccount provides a mock function with given fields: ctx, orgID, serviceAccountID
func (_m *MockServiceAccountService) DeleteServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64) error {
ret := _m.Called(ctx, orgID, serviceAccountID)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64, int64) error); ok {
r0 = rf(ctx, orgID, serviceAccountID)
} else {
r0 = ret.Error(0)
}
return r0
}
// DeleteServiceAccountToken provides a mock function with given fields: ctx, orgID, serviceAccountID, tokenID
func (_m *MockServiceAccountService) DeleteServiceAccountToken(ctx context.Context, orgID int64, serviceAccountID int64, tokenID int64) error {
ret := _m.Called(ctx, orgID, serviceAccountID, tokenID)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64, int64, int64) error); ok {
r0 = rf(ctx, orgID, serviceAccountID, tokenID)
} else {
r0 = ret.Error(0)
}
return r0
}
// EnableServiceAccount provides a mock function with given fields: ctx, orgID, serviceAccountID, enable
func (_m *MockServiceAccountService) EnableServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64, enable bool) error {
ret := _m.Called(ctx, orgID, serviceAccountID, enable)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64, int64, bool) error); ok {
r0 = rf(ctx, orgID, serviceAccountID, enable)
} else {
r0 = ret.Error(0)
}
return r0
}
// ListTokens provides a mock function with given fields: ctx, query
func (_m *MockServiceAccountService) ListTokens(ctx context.Context, query *serviceaccounts.GetSATokensQuery) ([]apikey.APIKey, error) {
ret := _m.Called(ctx, query)
var r0 []apikey.APIKey
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *serviceaccounts.GetSATokensQuery) ([]apikey.APIKey, error)); ok {
return rf(ctx, query)
}
if rf, ok := ret.Get(0).(func(context.Context, *serviceaccounts.GetSATokensQuery) []apikey.APIKey); ok {
r0 = rf(ctx, query)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]apikey.APIKey)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *serviceaccounts.GetSATokensQuery) error); ok {
r1 = rf(ctx, query)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MigrateApiKey provides a mock function with given fields: ctx, orgID, keyId
func (_m *MockServiceAccountService) MigrateApiKey(ctx context.Context, orgID int64, keyId int64) error {
ret := _m.Called(ctx, orgID, keyId)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64, int64) error); ok {
r0 = rf(ctx, orgID, keyId)
} else {
r0 = ret.Error(0)
}
return r0
}
// MigrateApiKeysToServiceAccounts provides a mock function with given fields: ctx, orgID
func (_m *MockServiceAccountService) MigrateApiKeysToServiceAccounts(ctx context.Context, orgID int64) (*serviceaccounts.MigrationResult, error) {
ret := _m.Called(ctx, orgID)
var r0 *serviceaccounts.MigrationResult
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, int64) (*serviceaccounts.MigrationResult, error)); ok {
return rf(ctx, orgID)
}
if rf, ok := ret.Get(0).(func(context.Context, int64) *serviceaccounts.MigrationResult); ok {
r0 = rf(ctx, orgID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*serviceaccounts.MigrationResult)
}
}
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
r1 = rf(ctx, orgID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RetrieveServiceAccount provides a mock function with given fields: ctx, orgID, serviceAccountID
func (_m *MockServiceAccountService) RetrieveServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64) (*serviceaccounts.ServiceAccountProfileDTO, error) {
ret := _m.Called(ctx, orgID, serviceAccountID)
var r0 *serviceaccounts.ServiceAccountProfileDTO
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, int64, int64) (*serviceaccounts.ServiceAccountProfileDTO, error)); ok {
return rf(ctx, orgID, serviceAccountID)
}
if rf, ok := ret.Get(0).(func(context.Context, int64, int64) *serviceaccounts.ServiceAccountProfileDTO); ok {
r0 = rf(ctx, orgID, serviceAccountID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*serviceaccounts.ServiceAccountProfileDTO)
}
}
if rf, ok := ret.Get(1).(func(context.Context, int64, int64) error); ok {
r1 = rf(ctx, orgID, serviceAccountID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RetrieveServiceAccountIdByName provides a mock function with given fields: ctx, orgID, name
func (_m *MockServiceAccountService) RetrieveServiceAccountIdByName(ctx context.Context, orgID int64, name string) (int64, error) {
ret := _m.Called(ctx, orgID, name)
var r0 int64
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, int64, string) (int64, error)); ok {
return rf(ctx, orgID, name)
}
if rf, ok := ret.Get(0).(func(context.Context, int64, string) int64); ok {
r0 = rf(ctx, orgID, name)
} else {
r0 = ret.Get(0).(int64)
}
if rf, ok := ret.Get(1).(func(context.Context, int64, string) error); ok {
r1 = rf(ctx, orgID, name)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SearchOrgServiceAccounts provides a mock function with given fields: ctx, query
func (_m *MockServiceAccountService) SearchOrgServiceAccounts(ctx context.Context, query *serviceaccounts.SearchOrgServiceAccountsQuery) (*serviceaccounts.SearchOrgServiceAccountsResult, error) {
ret := _m.Called(ctx, query)
var r0 *serviceaccounts.SearchOrgServiceAccountsResult
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *serviceaccounts.SearchOrgServiceAccountsQuery) (*serviceaccounts.SearchOrgServiceAccountsResult, error)); ok {
return rf(ctx, query)
}
if rf, ok := ret.Get(0).(func(context.Context, *serviceaccounts.SearchOrgServiceAccountsQuery) *serviceaccounts.SearchOrgServiceAccountsResult); ok {
r0 = rf(ctx, query)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*serviceaccounts.SearchOrgServiceAccountsResult)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *serviceaccounts.SearchOrgServiceAccountsQuery) error); ok {
r1 = rf(ctx, query)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateServiceAccount provides a mock function with given fields: ctx, orgID, serviceAccountID, saForm
func (_m *MockServiceAccountService) UpdateServiceAccount(ctx context.Context, orgID int64, serviceAccountID int64, saForm *serviceaccounts.UpdateServiceAccountForm) (*serviceaccounts.ServiceAccountProfileDTO, error) {
ret := _m.Called(ctx, orgID, serviceAccountID, saForm)
var r0 *serviceaccounts.ServiceAccountProfileDTO
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, int64, int64, *serviceaccounts.UpdateServiceAccountForm) (*serviceaccounts.ServiceAccountProfileDTO, error)); ok {
return rf(ctx, orgID, serviceAccountID, saForm)
}
if rf, ok := ret.Get(0).(func(context.Context, int64, int64, *serviceaccounts.UpdateServiceAccountForm) *serviceaccounts.ServiceAccountProfileDTO); ok {
r0 = rf(ctx, orgID, serviceAccountID, saForm)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*serviceaccounts.ServiceAccountProfileDTO)
}
}
if rf, ok := ret.Get(1).(func(context.Context, int64, int64, *serviceaccounts.UpdateServiceAccountForm) error); ok {
r1 = rf(ctx, orgID, serviceAccountID, saForm)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewMockServiceAccountService creates a new instance of MockServiceAccountService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockServiceAccountService(t interface {
mock.TestingT
Cleanup(func())
}) *MockServiceAccountService {
mock := &MockServiceAccountService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}