forked from pivotal-cf/cred-alert
/
fake_github_repository_service.go
264 lines (243 loc) · 8.3 KB
/
fake_github_repository_service.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
// Code generated by counterfeiter. DO NOT EDIT.
package revokfakes
import (
"context"
"cred-alert/revok"
"sync"
"github.com/google/go-github/github"
)
type FakeGithubRepositoryService struct {
ListByOrgStub func(ctx context.Context, org string, opt *github.RepositoryListByOrgOptions) ([]*github.Repository, *github.Response, error)
listByOrgMutex sync.RWMutex
listByOrgArgsForCall []struct {
ctx context.Context
org string
opt *github.RepositoryListByOrgOptions
}
listByOrgReturns struct {
result1 []*github.Repository
result2 *github.Response
result3 error
}
listByOrgReturnsOnCall map[int]struct {
result1 []*github.Repository
result2 *github.Response
result3 error
}
ListStub func(ctx context.Context, user string, opt *github.RepositoryListOptions) ([]*github.Repository, *github.Response, error)
listMutex sync.RWMutex
listArgsForCall []struct {
ctx context.Context
user string
opt *github.RepositoryListOptions
}
listReturns struct {
result1 []*github.Repository
result2 *github.Response
result3 error
}
listReturnsOnCall map[int]struct {
result1 []*github.Repository
result2 *github.Response
result3 error
}
GetStub func(ctx context.Context, owner, repo string) (*github.Repository, *github.Response, error)
getMutex sync.RWMutex
getArgsForCall []struct {
ctx context.Context
owner string
repo string
}
getReturns struct {
result1 *github.Repository
result2 *github.Response
result3 error
}
getReturnsOnCall map[int]struct {
result1 *github.Repository
result2 *github.Response
result3 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeGithubRepositoryService) ListByOrg(ctx context.Context, org string, opt *github.RepositoryListByOrgOptions) ([]*github.Repository, *github.Response, error) {
fake.listByOrgMutex.Lock()
ret, specificReturn := fake.listByOrgReturnsOnCall[len(fake.listByOrgArgsForCall)]
fake.listByOrgArgsForCall = append(fake.listByOrgArgsForCall, struct {
ctx context.Context
org string
opt *github.RepositoryListByOrgOptions
}{ctx, org, opt})
fake.recordInvocation("ListByOrg", []interface{}{ctx, org, opt})
fake.listByOrgMutex.Unlock()
if fake.ListByOrgStub != nil {
return fake.ListByOrgStub(ctx, org, opt)
}
if specificReturn {
return ret.result1, ret.result2, ret.result3
}
return fake.listByOrgReturns.result1, fake.listByOrgReturns.result2, fake.listByOrgReturns.result3
}
func (fake *FakeGithubRepositoryService) ListByOrgCallCount() int {
fake.listByOrgMutex.RLock()
defer fake.listByOrgMutex.RUnlock()
return len(fake.listByOrgArgsForCall)
}
func (fake *FakeGithubRepositoryService) ListByOrgArgsForCall(i int) (context.Context, string, *github.RepositoryListByOrgOptions) {
fake.listByOrgMutex.RLock()
defer fake.listByOrgMutex.RUnlock()
return fake.listByOrgArgsForCall[i].ctx, fake.listByOrgArgsForCall[i].org, fake.listByOrgArgsForCall[i].opt
}
func (fake *FakeGithubRepositoryService) ListByOrgReturns(result1 []*github.Repository, result2 *github.Response, result3 error) {
fake.ListByOrgStub = nil
fake.listByOrgReturns = struct {
result1 []*github.Repository
result2 *github.Response
result3 error
}{result1, result2, result3}
}
func (fake *FakeGithubRepositoryService) ListByOrgReturnsOnCall(i int, result1 []*github.Repository, result2 *github.Response, result3 error) {
fake.ListByOrgStub = nil
if fake.listByOrgReturnsOnCall == nil {
fake.listByOrgReturnsOnCall = make(map[int]struct {
result1 []*github.Repository
result2 *github.Response
result3 error
})
}
fake.listByOrgReturnsOnCall[i] = struct {
result1 []*github.Repository
result2 *github.Response
result3 error
}{result1, result2, result3}
}
func (fake *FakeGithubRepositoryService) List(ctx context.Context, user string, opt *github.RepositoryListOptions) ([]*github.Repository, *github.Response, error) {
fake.listMutex.Lock()
ret, specificReturn := fake.listReturnsOnCall[len(fake.listArgsForCall)]
fake.listArgsForCall = append(fake.listArgsForCall, struct {
ctx context.Context
user string
opt *github.RepositoryListOptions
}{ctx, user, opt})
fake.recordInvocation("List", []interface{}{ctx, user, opt})
fake.listMutex.Unlock()
if fake.ListStub != nil {
return fake.ListStub(ctx, user, opt)
}
if specificReturn {
return ret.result1, ret.result2, ret.result3
}
return fake.listReturns.result1, fake.listReturns.result2, fake.listReturns.result3
}
func (fake *FakeGithubRepositoryService) ListCallCount() int {
fake.listMutex.RLock()
defer fake.listMutex.RUnlock()
return len(fake.listArgsForCall)
}
func (fake *FakeGithubRepositoryService) ListArgsForCall(i int) (context.Context, string, *github.RepositoryListOptions) {
fake.listMutex.RLock()
defer fake.listMutex.RUnlock()
return fake.listArgsForCall[i].ctx, fake.listArgsForCall[i].user, fake.listArgsForCall[i].opt
}
func (fake *FakeGithubRepositoryService) ListReturns(result1 []*github.Repository, result2 *github.Response, result3 error) {
fake.ListStub = nil
fake.listReturns = struct {
result1 []*github.Repository
result2 *github.Response
result3 error
}{result1, result2, result3}
}
func (fake *FakeGithubRepositoryService) ListReturnsOnCall(i int, result1 []*github.Repository, result2 *github.Response, result3 error) {
fake.ListStub = nil
if fake.listReturnsOnCall == nil {
fake.listReturnsOnCall = make(map[int]struct {
result1 []*github.Repository
result2 *github.Response
result3 error
})
}
fake.listReturnsOnCall[i] = struct {
result1 []*github.Repository
result2 *github.Response
result3 error
}{result1, result2, result3}
}
func (fake *FakeGithubRepositoryService) Get(ctx context.Context, owner string, repo string) (*github.Repository, *github.Response, error) {
fake.getMutex.Lock()
ret, specificReturn := fake.getReturnsOnCall[len(fake.getArgsForCall)]
fake.getArgsForCall = append(fake.getArgsForCall, struct {
ctx context.Context
owner string
repo string
}{ctx, owner, repo})
fake.recordInvocation("Get", []interface{}{ctx, owner, repo})
fake.getMutex.Unlock()
if fake.GetStub != nil {
return fake.GetStub(ctx, owner, repo)
}
if specificReturn {
return ret.result1, ret.result2, ret.result3
}
return fake.getReturns.result1, fake.getReturns.result2, fake.getReturns.result3
}
func (fake *FakeGithubRepositoryService) GetCallCount() int {
fake.getMutex.RLock()
defer fake.getMutex.RUnlock()
return len(fake.getArgsForCall)
}
func (fake *FakeGithubRepositoryService) GetArgsForCall(i int) (context.Context, string, string) {
fake.getMutex.RLock()
defer fake.getMutex.RUnlock()
return fake.getArgsForCall[i].ctx, fake.getArgsForCall[i].owner, fake.getArgsForCall[i].repo
}
func (fake *FakeGithubRepositoryService) GetReturns(result1 *github.Repository, result2 *github.Response, result3 error) {
fake.GetStub = nil
fake.getReturns = struct {
result1 *github.Repository
result2 *github.Response
result3 error
}{result1, result2, result3}
}
func (fake *FakeGithubRepositoryService) GetReturnsOnCall(i int, result1 *github.Repository, result2 *github.Response, result3 error) {
fake.GetStub = nil
if fake.getReturnsOnCall == nil {
fake.getReturnsOnCall = make(map[int]struct {
result1 *github.Repository
result2 *github.Response
result3 error
})
}
fake.getReturnsOnCall[i] = struct {
result1 *github.Repository
result2 *github.Response
result3 error
}{result1, result2, result3}
}
func (fake *FakeGithubRepositoryService) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.listByOrgMutex.RLock()
defer fake.listByOrgMutex.RUnlock()
fake.listMutex.RLock()
defer fake.listMutex.RUnlock()
fake.getMutex.RLock()
defer fake.getMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeGithubRepositoryService) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ revok.GithubRepositoryService = new(FakeGithubRepositoryService)