-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmocks.go
More file actions
474 lines (396 loc) · 14 KB
/
mocks.go
File metadata and controls
474 lines (396 loc) · 14 KB
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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
package portal
import (
mock "github.com/stretchr/testify/mock"
"io"
"net/http"
"time"
)
// NewMockPortal creates a new instance of MockPortal. 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 NewMockPortal(t interface {
mock.TestingT
Cleanup(func())
}) *MockPortal {
mock := &MockPortal{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// MockPortal is an autogenerated mock type for the Portal type
type MockPortal struct {
mock.Mock
}
type MockPortal_Expecter struct {
mock *mock.Mock
}
func (_m *MockPortal) EXPECT() *MockPortal_Expecter {
return &MockPortal_Expecter{mock: &_m.Mock}
}
// DownloadBuildArtifact provides a mock function for the type MockPortal
func (_mock *MockPortal) DownloadBuildArtifact(product Product, build Build, file io.Writer, quiet bool) error {
ret := _mock.Called(product, build, file, quiet)
if len(ret) == 0 {
panic("no return value specified for DownloadBuildArtifact")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(Product, Build, io.Writer, bool) error); ok {
r0 = returnFunc(product, build, file, quiet)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockPortal_DownloadBuildArtifact_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DownloadBuildArtifact'
type MockPortal_DownloadBuildArtifact_Call struct {
*mock.Call
}
// DownloadBuildArtifact is a helper method to define mock.On call
// - product
// - build
// - file
// - quiet
func (_e *MockPortal_Expecter) DownloadBuildArtifact(product interface{}, build interface{}, file interface{}, quiet interface{}) *MockPortal_DownloadBuildArtifact_Call {
return &MockPortal_DownloadBuildArtifact_Call{Call: _e.mock.On("DownloadBuildArtifact", product, build, file, quiet)}
}
func (_c *MockPortal_DownloadBuildArtifact_Call) Run(run func(product Product, build Build, file io.Writer, quiet bool)) *MockPortal_DownloadBuildArtifact_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(Product), args[1].(Build), args[2].(io.Writer), args[3].(bool))
})
return _c
}
func (_c *MockPortal_DownloadBuildArtifact_Call) Return(err error) *MockPortal_DownloadBuildArtifact_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockPortal_DownloadBuildArtifact_Call) RunAndReturn(run func(product Product, build Build, file io.Writer, quiet bool) error) *MockPortal_DownloadBuildArtifact_Call {
_c.Call.Return(run)
return _c
}
// GetBuild provides a mock function for the type MockPortal
func (_mock *MockPortal) GetBuild(product Product, version string, hash string) (Build, error) {
ret := _mock.Called(product, version, hash)
if len(ret) == 0 {
panic("no return value specified for GetBuild")
}
var r0 Build
var r1 error
if returnFunc, ok := ret.Get(0).(func(Product, string, string) (Build, error)); ok {
return returnFunc(product, version, hash)
}
if returnFunc, ok := ret.Get(0).(func(Product, string, string) Build); ok {
r0 = returnFunc(product, version, hash)
} else {
r0 = ret.Get(0).(Build)
}
if returnFunc, ok := ret.Get(1).(func(Product, string, string) error); ok {
r1 = returnFunc(product, version, hash)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockPortal_GetBuild_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBuild'
type MockPortal_GetBuild_Call struct {
*mock.Call
}
// GetBuild is a helper method to define mock.On call
// - product
// - version
// - hash
func (_e *MockPortal_Expecter) GetBuild(product interface{}, version interface{}, hash interface{}) *MockPortal_GetBuild_Call {
return &MockPortal_GetBuild_Call{Call: _e.mock.On("GetBuild", product, version, hash)}
}
func (_c *MockPortal_GetBuild_Call) Run(run func(product Product, version string, hash string)) *MockPortal_GetBuild_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(Product), args[1].(string), args[2].(string))
})
return _c
}
func (_c *MockPortal_GetBuild_Call) Return(build Build, err error) *MockPortal_GetBuild_Call {
_c.Call.Return(build, err)
return _c
}
func (_c *MockPortal_GetBuild_Call) RunAndReturn(run func(product Product, version string, hash string) (Build, error)) *MockPortal_GetBuild_Call {
_c.Call.Return(run)
return _c
}
// ListAPIKeys provides a mock function for the type MockPortal
func (_mock *MockPortal) ListAPIKeys() ([]ApiKey, error) {
ret := _mock.Called()
if len(ret) == 0 {
panic("no return value specified for ListAPIKeys")
}
var r0 []ApiKey
var r1 error
if returnFunc, ok := ret.Get(0).(func() ([]ApiKey, error)); ok {
return returnFunc()
}
if returnFunc, ok := ret.Get(0).(func() []ApiKey); ok {
r0 = returnFunc()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]ApiKey)
}
}
if returnFunc, ok := ret.Get(1).(func() error); ok {
r1 = returnFunc()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockPortal_ListAPIKeys_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAPIKeys'
type MockPortal_ListAPIKeys_Call struct {
*mock.Call
}
// ListAPIKeys is a helper method to define mock.On call
func (_e *MockPortal_Expecter) ListAPIKeys() *MockPortal_ListAPIKeys_Call {
return &MockPortal_ListAPIKeys_Call{Call: _e.mock.On("ListAPIKeys")}
}
func (_c *MockPortal_ListAPIKeys_Call) Run(run func()) *MockPortal_ListAPIKeys_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockPortal_ListAPIKeys_Call) Return(apiKeys []ApiKey, err error) *MockPortal_ListAPIKeys_Call {
_c.Call.Return(apiKeys, err)
return _c
}
func (_c *MockPortal_ListAPIKeys_Call) RunAndReturn(run func() ([]ApiKey, error)) *MockPortal_ListAPIKeys_Call {
_c.Call.Return(run)
return _c
}
// ListBuilds provides a mock function for the type MockPortal
func (_mock *MockPortal) ListBuilds(product Product) (Builds, error) {
ret := _mock.Called(product)
if len(ret) == 0 {
panic("no return value specified for ListBuilds")
}
var r0 Builds
var r1 error
if returnFunc, ok := ret.Get(0).(func(Product) (Builds, error)); ok {
return returnFunc(product)
}
if returnFunc, ok := ret.Get(0).(func(Product) Builds); ok {
r0 = returnFunc(product)
} else {
r0 = ret.Get(0).(Builds)
}
if returnFunc, ok := ret.Get(1).(func(Product) error); ok {
r1 = returnFunc(product)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockPortal_ListBuilds_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListBuilds'
type MockPortal_ListBuilds_Call struct {
*mock.Call
}
// ListBuilds is a helper method to define mock.On call
// - product
func (_e *MockPortal_Expecter) ListBuilds(product interface{}) *MockPortal_ListBuilds_Call {
return &MockPortal_ListBuilds_Call{Call: _e.mock.On("ListBuilds", product)}
}
func (_c *MockPortal_ListBuilds_Call) Run(run func(product Product)) *MockPortal_ListBuilds_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(Product))
})
return _c
}
func (_c *MockPortal_ListBuilds_Call) Return(availablePackages Builds, err error) *MockPortal_ListBuilds_Call {
_c.Call.Return(availablePackages, err)
return _c
}
func (_c *MockPortal_ListBuilds_Call) RunAndReturn(run func(product Product) (Builds, error)) *MockPortal_ListBuilds_Call {
_c.Call.Return(run)
return _c
}
// RegisterAPIKey provides a mock function for the type MockPortal
func (_mock *MockPortal) RegisterAPIKey(owner string, organization string, role string, expiresAt time.Time) error {
ret := _mock.Called(owner, organization, role, expiresAt)
if len(ret) == 0 {
panic("no return value specified for RegisterAPIKey")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(string, string, string, time.Time) error); ok {
r0 = returnFunc(owner, organization, role, expiresAt)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockPortal_RegisterAPIKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterAPIKey'
type MockPortal_RegisterAPIKey_Call struct {
*mock.Call
}
// RegisterAPIKey is a helper method to define mock.On call
// - owner
// - organization
// - role
// - expiresAt
func (_e *MockPortal_Expecter) RegisterAPIKey(owner interface{}, organization interface{}, role interface{}, expiresAt interface{}) *MockPortal_RegisterAPIKey_Call {
return &MockPortal_RegisterAPIKey_Call{Call: _e.mock.On("RegisterAPIKey", owner, organization, role, expiresAt)}
}
func (_c *MockPortal_RegisterAPIKey_Call) Run(run func(owner string, organization string, role string, expiresAt time.Time)) *MockPortal_RegisterAPIKey_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(string), args[2].(string), args[3].(time.Time))
})
return _c
}
func (_c *MockPortal_RegisterAPIKey_Call) Return(err error) *MockPortal_RegisterAPIKey_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockPortal_RegisterAPIKey_Call) RunAndReturn(run func(owner string, organization string, role string, expiresAt time.Time) error) *MockPortal_RegisterAPIKey_Call {
_c.Call.Return(run)
return _c
}
// RevokeAPIKey provides a mock function for the type MockPortal
func (_mock *MockPortal) RevokeAPIKey(key string) error {
ret := _mock.Called(key)
if len(ret) == 0 {
panic("no return value specified for RevokeAPIKey")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(string) error); ok {
r0 = returnFunc(key)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockPortal_RevokeAPIKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RevokeAPIKey'
type MockPortal_RevokeAPIKey_Call struct {
*mock.Call
}
// RevokeAPIKey is a helper method to define mock.On call
// - key
func (_e *MockPortal_Expecter) RevokeAPIKey(key interface{}) *MockPortal_RevokeAPIKey_Call {
return &MockPortal_RevokeAPIKey_Call{Call: _e.mock.On("RevokeAPIKey", key)}
}
func (_c *MockPortal_RevokeAPIKey_Call) Run(run func(key string)) *MockPortal_RevokeAPIKey_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *MockPortal_RevokeAPIKey_Call) Return(err error) *MockPortal_RevokeAPIKey_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockPortal_RevokeAPIKey_Call) RunAndReturn(run func(key string) error) *MockPortal_RevokeAPIKey_Call {
_c.Call.Return(run)
return _c
}
// UpdateAPIKey provides a mock function for the type MockPortal
func (_mock *MockPortal) UpdateAPIKey(key string, expiresAt time.Time) error {
ret := _mock.Called(key, expiresAt)
if len(ret) == 0 {
panic("no return value specified for UpdateAPIKey")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(string, time.Time) error); ok {
r0 = returnFunc(key, expiresAt)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockPortal_UpdateAPIKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateAPIKey'
type MockPortal_UpdateAPIKey_Call struct {
*mock.Call
}
// UpdateAPIKey is a helper method to define mock.On call
// - key
// - expiresAt
func (_e *MockPortal_Expecter) UpdateAPIKey(key interface{}, expiresAt interface{}) *MockPortal_UpdateAPIKey_Call {
return &MockPortal_UpdateAPIKey_Call{Call: _e.mock.On("UpdateAPIKey", key, expiresAt)}
}
func (_c *MockPortal_UpdateAPIKey_Call) Run(run func(key string, expiresAt time.Time)) *MockPortal_UpdateAPIKey_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(time.Time))
})
return _c
}
func (_c *MockPortal_UpdateAPIKey_Call) Return(err error) *MockPortal_UpdateAPIKey_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockPortal_UpdateAPIKey_Call) RunAndReturn(run func(key string, expiresAt time.Time) error) *MockPortal_UpdateAPIKey_Call {
_c.Call.Return(run)
return _c
}
// NewMockHttpClient creates a new instance of MockHttpClient. 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 NewMockHttpClient(t interface {
mock.TestingT
Cleanup(func())
}) *MockHttpClient {
mock := &MockHttpClient{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// MockHttpClient is an autogenerated mock type for the HttpClient type
type MockHttpClient struct {
mock.Mock
}
type MockHttpClient_Expecter struct {
mock *mock.Mock
}
func (_m *MockHttpClient) EXPECT() *MockHttpClient_Expecter {
return &MockHttpClient_Expecter{mock: &_m.Mock}
}
// Do provides a mock function for the type MockHttpClient
func (_mock *MockHttpClient) Do(request *http.Request) (*http.Response, error) {
ret := _mock.Called(request)
if len(ret) == 0 {
panic("no return value specified for Do")
}
var r0 *http.Response
var r1 error
if returnFunc, ok := ret.Get(0).(func(*http.Request) (*http.Response, error)); ok {
return returnFunc(request)
}
if returnFunc, ok := ret.Get(0).(func(*http.Request) *http.Response); ok {
r0 = returnFunc(request)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*http.Response)
}
}
if returnFunc, ok := ret.Get(1).(func(*http.Request) error); ok {
r1 = returnFunc(request)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockHttpClient_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do'
type MockHttpClient_Do_Call struct {
*mock.Call
}
// Do is a helper method to define mock.On call
// - request
func (_e *MockHttpClient_Expecter) Do(request interface{}) *MockHttpClient_Do_Call {
return &MockHttpClient_Do_Call{Call: _e.mock.On("Do", request)}
}
func (_c *MockHttpClient_Do_Call) Run(run func(request *http.Request)) *MockHttpClient_Do_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*http.Request))
})
return _c
}
func (_c *MockHttpClient_Do_Call) Return(response *http.Response, err error) *MockHttpClient_Do_Call {
_c.Call.Return(response, err)
return _c
}
func (_c *MockHttpClient_Do_Call) RunAndReturn(run func(request *http.Request) (*http.Response, error)) *MockHttpClient_Do_Call {
_c.Call.Return(run)
return _c
}